/* ============================================
   Frost Command Center — 5.0
   ============================================

   Every rule in this file is scoped under `.frost-cc-active`, which is added
   only when the server-side feature flag is on. With the flag off that class
   is never written, so none of these selectors match and the cascade produces
   exactly 4.24.0's appearance -- not by reverting anything, but because none
   of it ever applies.

   That is deliberate, and it is what allows this stylesheet to be loaded
   unconditionally. The alternative -- injecting the <link> only when enabled --
   sounds tidier and is worse: it makes turning the flag on a network round trip
   into an unstyled interface, so the first thing the owner would see after
   enabling the feature is a flash of broken layout.

   Namespace note: `frost-cc-`, NOT `fcc-`. `.fcc-*` already belongs to the
   unrelated frost_agents/frost_boards admin feature in migrate/schema.sql and
   public/js/app.js. Two features named "Frost Command Center" is confusing
   enough without them silently restyling each other.

   Colours come from tokens.css. Nothing here hard-codes a palette value, so
   light mode keeps working without a second copy of every rule. */

/* --------------------------------------------------------------------------
   Tokens local to this surface.

   Declared on the scoping class rather than :root so they cost nothing when
   the feature is off, and so a future second surface can override them without
   reaching into the global token set.
   -------------------------------------------------------------------------- */

.frost-cc-active {
  /* A single column grows to a legible measure; additional columns use the
     count-based rail widths below rather than stretching across the display. */
  --frost-cc-rail-w: clamp(250px, 16vw, 360px);
  --frost-cc-gutter: 24px;
  --frost-cc-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --frost-cc-dur: 320ms;
  --frost-cc-scrim: rgba(10, 10, 18, 0.72);
  /* Used below by .frost-cc-act-ms with a `monospace` fallback, but never
     defined anywhere in this stylesheet or in tokens.css/base.css/
     components.css -- verified by grepping all four for a definition
     (`--font-mono:`) versus the one usage site. Defined here so the
     fallback is no longer load-bearing. */
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  /* The cap on the conversation column. See the grid-template rules below:
     this is what stops extra display width being poured into the reading
     measure. A prose measure rather than a round number -- at the panel's font
     size this is roughly 90-110 characters, the top of the comfortable range.

     Wider displays can spend the surplus on additional widget columns without
     increasing this reading measure. */
  --frost-cc-measure: clamp(0px, 100%, 720px);
  --frost-cc-nav-offset: 0px;
}

/* --------------------------------------------------------------------------
   AMBIENT

   The resting state, and the one that must look like nothing happened. The
   orb sits where it always sat. The only thing this mode adds is a hint that
   the command centre exists at all.
   -------------------------------------------------------------------------- */

.frost-cc-active.frost-cc-mode-ambient .frost-cc-surface {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* --------------------------------------------------------------------------
   CONVERSATION

   A turn is in progress. The page recedes rather than disappears: the site is
   still the thing the visitor came for, and a voice answer is usually about
   what is on screen behind it.
   -------------------------------------------------------------------------- */

.frost-cc-active.frost-cc-mode-conversation .frost-cc-scrim {
  opacity: 1;
  pointer-events: auto;
}

.frost-cc-scrim {
  position: fixed;
  inset: 0;
  background: var(--frost-cc-scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--frost-cc-dur) var(--frost-cc-ease);
  z-index: 90;
}

/* --------------------------------------------------------------------------
   COMMAND CENTER

   Frost as the whole surface. Grid rather than absolute positioning, so the
   rail can be removed from the layout entirely when there is nothing to put
   in it -- see the empty-rail rule below.
   -------------------------------------------------------------------------- */

.frost-cc-surface {
  --frost-cc-left-columns: 1;
  --frost-cc-right-columns: 1;
  --frost-cc-left-w: calc(var(--frost-cc-rail-w) + (var(--frost-cc-left-columns) - 1) * 272px);
  --frost-cc-right-w: calc(var(--frost-cc-rail-w) + (var(--frost-cc-right-columns) - 1) * 272px);
  --frost-cc-left-min: calc(var(--frost-cc-left-columns) * 160px + (var(--frost-cc-left-columns) - 1) * 12px + 25px);
  --frost-cc-right-min: calc(var(--frost-cc-right-columns) * 160px + (var(--frost-cc-right-columns) - 1) * 12px + 25px);
  position: fixed;
  inset: var(--frost-cc-nav-offset) 0 0;
  /* base.css intentionally renders the site at 80% density. Fixed viewport
     surfaces must cancel that ancestor zoom or they cover only 80% of the
     phone, exposing the page and placing widget rows over the conversation. */
  zoom: 1.25;
  /* 9001, which is `.frost-panel`'s own value in style.css:2773.
     -------------------------------------------------------------
     Not an arbitrary "on top" number. The panel now lives inside this
     element, so the surface has to occupy the stacking position the panel
     used to occupy or the panel's neighbours change places around it. At the
     original 100 this surface sat UNDER `.frost-orb` (9000) and
     `.frost-mute-btn` (9001), so both would have floated over the command
     centre -- found by listing every z-index >= 90 in style.css rather than
     by reasoning about the two elements that came to mind.

     Matching 9001 exactly means the hosted panel keeps precisely the
     relationships it has today. The nav is elevated as a complete stacking
     context below so its controls remain reachable; a child z-index cannot
     escape the nav's own z-index: 100 stacking context. */
  z-index: 9001;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--frost-cc-gutter);
  padding: var(--frost-cc-gutter);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--frost-cc-dur) var(--frost-cc-ease),
    visibility 0s linear var(--frost-cc-dur);
}

/* Track count is decided by the code that knows whether it filled a rail,
   not re-derived from the DOM. `:empty` below still hides a rail that has
   nothing in it; these stop a hidden rail leaving a blank column behind.

   The centre track is capped by `--frost-cc-measure` rather than `1fr`.
   With `1fr` the
   conversation column absorbed every pixel of extra width, so on a 3840px
   display the grid measured 320px + 3438px and the widest message bubble was
   372px -- 9.7% of the screen. Nothing reflowed, nothing redistributed, and
   more monitor bought more emptiness.

   Each side's width follows its configured visible column count. Capping all
   three tracks prevents a one-column preference becoming a monitor-wide card.
   Prose has an optimal measure of roughly 70-90 characters and a 3438px line
   is not better than a 900px one, it is worse. */
.frost-cc-surface.frost-cc-with-left  { grid-template-columns: minmax(var(--frost-cc-left-min), var(--frost-cc-left-w)) minmax(320px, var(--frost-cc-measure)); }
.frost-cc-surface.frost-cc-with-right { grid-template-columns: minmax(320px, var(--frost-cc-measure)) minmax(var(--frost-cc-right-min), var(--frost-cc-right-w)); }
.frost-cc-surface.frost-cc-with-left.frost-cc-with-right {
  grid-template-columns:
    minmax(var(--frost-cc-left-min), var(--frost-cc-left-w))
    minmax(320px, var(--frost-cc-measure))
    minmax(var(--frost-cc-right-min), var(--frost-cc-right-w));
}

/* Centre the whole composition once the tracks stop growing, so the surplus is
   split evenly instead of pooling on one side. Below the cap this is a no-op --
   the tracks still fill the surface. */
.frost-cc-surface { justify-content: center; }

.frost-cc-active.frost-cc-mode-command-center .frost-cc-surface {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  /* Visibility flips immediately on the way in and is delayed on the way out,
     so the fade-out is actually seen instead of being cut off at frame one. */
  transition-delay: 0s, 0s;
}

.frost-cc-active.frost-cc-mode-command-center #nav {
  z-index: 9002;
}

.frost-cc-main {
  display: flex;
  flex-direction: column;
  min-width: 0;   /* without this a long unbroken transcript line stretches the
                     grid column instead of wrapping */
  min-height: 0;  /* and without this the transcript scrolls the page instead
                     of itself */
  gap: 12px;
}

/* --------------------------------------------------------------------------
   The hosted chat panel.

   `.frost-panel` is `position: fixed; inset: 0; z-index: 9001` in style.css --
   it has always been a full-screen overlay in its own right. That is why
   enabling the flag appeared to do nothing: the surface below was rendering
   correctly at z-index 100 and the panel was simply sitting on top of it,
   opaque and blurred. Two full-screen overlays, the wrong one in front.

   Taking it out of fixed positioning is what lets the grid above own the
   layout, so the rail can appear beside the conversation the day it has
   something to show. The panel keeps its own internal flex column, its
   handlers, and its canvas.

   Scoped to `> .frost-panel` so it applies only where the panel has actually
   been reparented. If the move ever fails, the panel keeps its original
   full-screen behaviour rather than being left half-styled -- broken in the
   direction of the interface that works.
   -------------------------------------------------------------------------- */

.frost-cc-active .frost-cc-main > .frost-panel {
  position: relative;
  inset: auto;
  z-index: auto;
  flex: 1 1 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-top: 0;
  /* The surface already paints `var(--bg)`. A second opaque background here
     would hide it, and a second 40px backdrop-filter would blur the first
     one's output for no benefit. */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.frost-cc-active .frost-cc-main > .frost-panel .frost-panel-top {
  display: none;
}

.frost-cc-active .frost-cc-main > .frost-panel .frost-panel-mid {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.frost-cc-active .frost-cc-main > .frost-panel .frost-messages {
  min-height: 0;
  overscroll-behavior: contain;
}

.frost-cc-active .frost-cc-main > .frost-panel .frost-panel-bottom {
  position: sticky;
  z-index: 2;
  bottom: 0;
  min-width: 0;
  max-width: 100%;
  background: var(--bg);
}

.frost-cc-active .frost-cc-main > .frost-panel .frost-input-row,
.frost-cc-active .frost-cc-main > .frost-panel .frost-input-box,
.frost-cc-active .frost-cc-main > .frost-panel .frost-input {
  min-width: 0;
}

/* NOT NEUTRALISED, DELIBERATELY: `transform` and `transition`.
   -----------------------------------------------------------
   The panel opens with `transform: scale(1.05)` -> `scale(1)` over 0.5s
   (style.css:2782-2789). This block outranks both of those rules, so a
   `transform: none` here would not soften that animation -- it would delete
   it, in the release whose whole subject is motion.

   The subtler half: the panel has carried a transform for its entire
   existence, and a transformed element is the containing block for its
   `position: fixed` descendants and its own stacking context. Every child has
   been laid out inside that. Keeping the transform preserves today's
   behaviour exactly; removing it is the change, however conservative
   `none` looks written down. A transform on a `position: relative` grid child
   is harmless -- it paints, it does not participate in track sizing. */

/* --------------------------------------------------------------------------
   Safety net.

   The panel is the owner's working chat. Hosting it inside an element that can
   be hidden means a fault in the mode machinery could take the chat away
   entirely -- a far worse outcome than the command centre never opening.

   So: if the panel is open, the surface containing it is visible, whatever
   mode was derived. `visibility` could be forced back on from the child, but
   `opacity` cannot -- an ancestor at `opacity: 0` hides its subtree no matter
   what the child asks for -- so this has to live on the ancestor.

   For this to hide the chat, both the mode logic and this rule must fail.
   -------------------------------------------------------------------------- */

.frost-cc-active .frost-cc-surface:has(.frost-panel.open) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.frost-cc-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding-left: var(--frost-cc-gutter);
  border-left: 1px solid var(--border);
}

.frost-cc-rail > .frost-cc-panel {
  flex-shrink: 0;
}

.frost-cc-widget-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 72px;
  flex-shrink: 0;
}

.frost-cc-widget-column[hidden] { display: none; }
.frost-cc-rail.is-spanning {
  display: grid;
  grid-template-columns: repeat(var(--frost-grid-columns), minmax(0, 1fr));
  grid-auto-rows: 1px;
  row-gap: 0;
  column-gap: 12px;
  align-content: start;
}
.frost-cc-rail.is-spanning > .frost-cc-widget-column:not([hidden]) { display: contents; }
.frost-cc-rail.is-spanning .frost-cc-widget { align-self: start; min-width: 0; }
.frost-cc-visual-widget { min-width: 0; container-type: inline-size; }
.frost-cc-visual-widget:not(.is-minimized) { display: flex; flex-direction: column; }
.frost-cc-visual-widget[data-widget-id="routing-flow"]:not(.is-minimized) { height: 465px; }
.frost-cc-visual-widget[data-widget-id="request-flow"]:not(.is-minimized) { min-height: 220px; }
.frost-cc-visual-widget[data-widget-id="curator-galaxy"]:not(.is-minimized) { height: 465px; }
.frost-cc-visual-widget.is-visual-loaded > .frost-cc-empty-state,
.frost-cc-visual-widget.is-visual-loaded > .frost-cc-visual-refresh { display: none; }
.frost-cc-visual-body { flex: 1; min-width: 0; min-height: 0; overflow: auto; overflow-wrap: anywhere; }
.frost-cc-visual-body > div { height: 100%; }
.frost-cc-visual-widget .frost-cc-routing-view { display: flex; flex-direction: column; height: 100%; }
.frost-cc-routing-view > .arch-panel {
  display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: auto;
}
.frost-cc-routing-view > .arch-panel > .arch-routing {
  flex: 1 0 240px; min-height: calc(240px + var(--widget-control-size, 20px) * 6);
}
.frost-cc-routing-view > .arch-panel > :not(.arch-routing) { flex-shrink: 0; }
.frost-cc-routing-view .arch-universe,
.frost-cc-routing-view .arch-viewer-frame { height: 100%; }
.frost-cc-visual-widget .arch-universe .au-stage,
.frost-cc-visual-widget .arch-viewer-frame .arch-routing-viewport {
  height: 100%; min-height: 0;
}
.frost-cc-visual-widget .arch-universe .au-hud {
  position: absolute; inset: 12px 12px 12px auto;
  width: min(360px, calc(100% - 24px)); max-height: none; overflow: auto;
}
.frost-cc-visual-widget .kmt-btn,
.frost-cc-visual-widget .kmt-movie-close,
.frost-cc-visual-refresh { min-width: 44px; min-height: 44px; }
.frost-cc-visual-widget .kmt-console {
  position: relative; gap: 6px; padding: 0; border: 0; background: none; backdrop-filter: none;
}
.frost-cc-visual-widget .kmt-galaxy-stage { position: static; flex: 1; min-height: 100px; }
.frost-cc-visual-widget .kmt-galaxy-canvas { height: 100%; }
.frost-cc-visual-widget .kmt-galaxy-toolbar { flex: 0 0 auto; flex-direction: column; align-items: stretch; }
.frost-cc-visual-widget .kmt-galaxy-controls { flex-wrap: wrap; gap: 4px; }
.frost-cc-visual-widget .kmt-galaxy-search .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.frost-cc-visual-widget .kmt-movie-panel { display: block; overflow: auto; }
.frost-cc-visual-widget .kmt-movie-panel[hidden] { display: none; }
.frost-cc-visual-widget .kmt-movie-poster { height: 90px; object-fit: contain; }
.frost-cc-visual-widget .kmt-movie-copy { overflow: visible; }
.frost-cc-visual-body input { width: 100%; min-width: 0; min-height: 44px; }
.frost-cc-visual-detail, .frost-cc-visual-note { font-size: .75rem; line-height: 1.5; }
.frost-cc-active .frost-request-flow {
  display: flex;
  flex-direction: column;
  min-height: 170px;
  gap: 14px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent2) 24%, var(--border));
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent2) 12%, transparent), transparent 48%),
    var(--surface-inset);
  overflow: hidden;
}
.frost-cc-active .frost-request-flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.frost-cc-active .frost-request-flow-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: .78rem;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.frost-cc-active .frost-request-flow-status {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--accent2) 35%, var(--border));
  border-radius: 999px;
  color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 9%, transparent);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
}
.frost-cc-active .frost-request-flow-track {
  display: flex;
  align-items: center;
  min-height: 72px;
  gap: 6px;
  padding: 4px 2px 10px;
  overflow: hidden;
}
.frost-cc-active .frost-request-flow-node {
  --flow-color: var(--accent2);
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: none;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--flow-color) 45%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--flow-color) 8%, var(--card-bg));
  color: var(--text);
  opacity: 0;
  transform: translateY(8px) scale(.96);
  animation: frost-request-node 440ms var(--frost-cc-ease) forwards;
  animation-delay: calc(var(--flow-step) * 120ms);
}
.frost-cc-active .frost-request-flow-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--flow-color) 18%, transparent);
  color: var(--flow-color);
  font-size: 1rem;
  font-weight: 800;
}
.frost-cc-active .frost-request-flow-label {
  min-width: 0;
  overflow: hidden;
  font-size: .7rem;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frost-cc-active .frost-request-flow-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.frost-cc-active .frost-request-flow-time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .58rem;
  line-height: 1;
  white-space: nowrap;
}
.frost-cc-active .frost-request-flow-connector {
  position: relative;
  flex: 0 1 24px;
  min-width: 8px;
  height: 2px;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent2) 25%, var(--border));
}
.frost-cc-active .frost-request-flow-connector::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent2), transparent);
  transform: translateX(-100%);
  animation: frost-request-connector 720ms ease-out forwards;
  animation-delay: calc(var(--flow-step) * 120ms);
}
.frost-cc-active .frost-request-flow-request {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.frost-cc-active .frost-request-flow-picker {
  width: 100%;
  min-width: 0;
  padding: 8px;
  color: var(--text);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}
.frost-cc-active .frost-request-flow[data-native="true"] .frost-request-flow-track {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 320px;
  overflow-y: auto;
}
.frost-cc-active .frost-request-flow[data-native="true"] .frost-request-flow-connector { display: none; }
.frost-cc-active .frost-request-flow[data-native="true"] .frost-request-flow-label {
  white-space: normal;
  overflow-wrap: anywhere;
}
.frost-cc-active .frost-request-flow[data-native="true"] .frost-request-flow-request {
  display: block;
  -webkit-line-clamp: unset;
}
.frost-cc-active .frost-request-flow-handoffs {
  font-size: .72rem;
  overflow-wrap: anywhere;
}
.frost-cc-active .frost-request-flow[data-status="completed"] .frost-request-flow-status { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.frost-cc-active .frost-request-flow[data-status="failed"] .frost-request-flow-status { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.frost-cc-active .frost-request-flow[data-status="interrupted"] .frost-request-flow-status { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
@container (max-width: 460px) {
  .frost-cc-active .frost-request-flow-track {
    flex-wrap: wrap;
  }
  .frost-cc-active .frost-request-flow-node {
    flex-basis: calc(50% - 4px);
  }
  .frost-cc-active .frost-request-flow-connector {
    display: none;
  }
}
@keyframes frost-request-node {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes frost-request-connector {
  to { transform: translateX(100%); }
}
@media (max-width: 600px) {
  .frost-cc-visual-widget[data-widget-id="routing-flow"]:not(.is-minimized) { height: 420px; }
  .frost-cc-visual-widget[data-widget-id="request-flow"]:not(.is-minimized) { min-height: 210px; }
  .frost-cc-visual-widget[data-widget-id="curator-galaxy"]:not(.is-minimized) { height: 547.5px; }
}
.frost-cc-visual-widget button:focus-visible, .frost-cc-visual-body input:focus-visible {
  outline: 2px solid var(--frost-status-ok); outline-offset: 2px;
}
.frost-cc-widget.is-context-widget {
  outline: 2px solid var(--frost-status-ok); outline-offset: 3px;
  box-shadow: 0 0 20px color-mix(in srgb, var(--frost-status-ok) 25%, transparent);
  animation: frost-cc-context-reveal 1.1s ease-out 2;
}
@keyframes frost-cc-context-reveal {
  0%, 100% { box-shadow: 0 0 0 color-mix(in srgb, var(--frost-status-ok) 0%, transparent); }
  50% { box-shadow: 0 0 24px color-mix(in srgb, var(--frost-status-ok) 38%, transparent); }
}
.frost-cc-context-notice {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.frost-cc-widget-column > .frost-cc-panel { flex-shrink: 0; min-width: 0; }
.frost-cc-widget-column.is-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}
.frost-cc-widget.is-drop-before { box-shadow: 0 -3px 0 var(--accent); }
.frost-cc-widget.is-drop-after { box-shadow: 0 3px 0 var(--accent); }
.frost-cc-widget.is-dragging { pointer-events: none; }
.frost-cc-surface.is-widget-dragging .frost-cc-widget-column:empty::after {
  content: 'Drop widget here';
  padding: 16px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  pointer-events: none;
}

.frost-cc-surface.is-widget-dragging .frost-cc-rail:not(.is-spanning) > .frost-cc-widget-column:not([hidden]) {
  min-height: 100%;
  border-radius: 12px;
}

/* The left rail's divider belongs on its inner edge, not its outer one. */
.frost-cc-rail-left {
  border-left: none;
  border-right: 1px solid var(--border);
  padding-left: 0;
  padding-right: var(--frost-cc-gutter);
}

/* A rail is hidden when it has nothing genuine to show.

   The right rail starts empty and fills itself the moment a real tool call
   happens -- `addActivity` attaches its panel on the first `frost:activity`
   event and not before, so an interface that has done nothing shows nothing
   rather than a heading over a blank box. `:empty` makes that automatic in CSS
   too, which means the rail cannot be left visible-but-blank by a JS path that
   forgets to check.

   Spec line 280 forbids filling a panel with fake content; it does not license
   shipping no content when real content is available, which for service status
   (260-262) and now for measured pipeline activity (addendum 439) it is. */
.frost-cc-rail:empty {
  display: none;
}

.frost-cc-rail.is-empty { display: none; }

.frost-cc-surface.is-widget-dragging .frost-cc-rail:empty,
.frost-cc-surface.is-widget-dragging .frost-cc-rail.is-empty {
  display: flex;
  min-height: 72px;
  border-color: color-mix(in srgb, var(--accent) 44%, var(--border));
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

@media (min-width: 901px) {
  .frost-cc-surface.is-widget-dragging {
    grid-template-columns:
      minmax(var(--frost-cc-left-min), var(--frost-cc-left-w))
      minmax(320px, var(--frost-cc-measure))
      minmax(var(--frost-cc-right-min), var(--frost-cc-right-w));
  }
}

@media (min-width: 1280px) {
  .frost-cc-rail,
  .frost-cc-surface.is-widget-dragging .frost-cc-rail:empty,
  .frost-cc-surface.is-widget-dragging .frost-cc-rail.is-empty {
    display: grid;
    grid-auto-rows: max-content;
    align-content: start;
    align-items: start;
    min-width: 0;
  }

  .frost-cc-rail-left {
    grid-template-columns: repeat(var(--frost-cc-left-columns), minmax(0, 1fr));
  }

  .frost-cc-rail-right {
    grid-template-columns: repeat(var(--frost-cc-right-columns), minmax(0, 1fr));
  }

  .frost-cc-rail > .frost-cc-panel { min-width: 0; }
  .frost-cc-rail:empty { display: none; }
  .frost-cc-rail.is-empty { display: none; }
}

.frost-cc-catalog-search input {
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.frost-cc-catalog-search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Activity list (addendum 439).

   Every row here is a thing that actually happened, with a duration that was
   actually measured. Newest first, capped at eight in JS -- a rail that grows
   without bound turns into a scroll region nobody reads, and the ninth-oldest
   search is not information.
   -------------------------------------------------------------------------- */

.frost-cc-activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.frost-cc-act {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

/* The kinds are distinguishable, for the same reason the states are: a search
   and a model run are different events and a single accent for both makes the
   rail a list of undifferentiated blips. */
.frost-cc-act[data-kind="search"] { border-left-color: var(--accent2); }
.frost-cc-act[data-kind="model"]  { border-left-color: var(--accent); }
.frost-cc-act[data-kind="result"] { border-left-color: var(--muted); }
.frost-cc-act[data-failed="true"] { border-left-color: var(--danger); }

.frost-cc-act-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.frost-cc-act-label {
  font-size: 0.8rem;
  color: var(--text);
  /* Model names and queries are both arbitrary length and neither is worth a
     second line in a rail. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frost-cc-act-ms {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  color: var(--muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

.frost-cc-act-detail {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frost-cc-widget-note {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.frost-cc-agent-status {
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.frost-cc-agent-status[data-status="running"],
.frost-cc-agent-status[data-status="queued"],
.frost-cc-agent-status[data-status="delegated"] {
  color: var(--accent);
}

.frost-cc-agent-status[data-status="waiting_for_approval"],
.frost-cc-agent-status[data-status="cancellation_requested"] {
  color: var(--frost-status-issue, #fbbf24);
}

.frost-cc-agent-status[data-status="completed"] {
  color: var(--accent2);
}

.frost-cc-agent-status[data-status="failed"],
.frost-cc-agent-status[data-status="cancelled"] {
  color: var(--danger);
}

.frost-cc-task-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0.75rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  list-style: none;
  text-transform: uppercase;
}

.frost-cc-task-group > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frost-cc-task-group-clear {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.frost-cc-task-group-clear svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.frost-cc-task-group-clear:hover:not(:disabled) {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.frost-cc-task-group-clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.frost-cc-task-group-clear:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (pointer: coarse) {
  .frost-cc-task-group-clear {
    width: 44px;
    height: 44px;
  }
}

.frost-cc-task-group:first-child {
  margin-top: 0;
}

.frost-cc-task-flow {
  margin: 4px 0 12px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, var(--card-bg)), var(--card-bg));
  min-width: 0;
}
.frost-cc-task-flow-heading {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font: 600 0.62rem var(--font-mono);
}
.frost-cc-task-flow-heading > :last-child { color: var(--accent); }
.frost-cc-task-flow-list { display: grid; gap: 8px; }
.frost-cc-task-flow-row {
  --flow-color: var(--accent);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  padding-top: 10px;
  color: var(--flow-color);
}
.frost-cc-task-flow-row[data-state="approval"],
.frost-cc-task-flow-row[data-state="requested"] { --flow-color: var(--frost-status-issue, #fbbf24); }
.frost-cc-task-flow-row[data-state="completed"] { --flow-color: var(--frost-status-ok, #4ade80); }
.frost-cc-task-flow-row[data-state="failed"] { --flow-color: var(--frost-status-critical, #f87171); }
.frost-cc-task-flow-row[data-state="cancelled"],
.frost-cc-task-flow-row[data-state="unknown"] { --flow-color: var(--muted); }
.frost-cc-task-flow-actor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.frost-cc-task-flow-symbol {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--flow-color) 45%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--flow-color) 9%, var(--card-bg));
  box-shadow: 0 0 12px color-mix(in srgb, var(--flow-color) 12%, transparent);
  font: 600 0.62rem var(--font-mono);
}
.frost-cc-task-flow-name {
  color: var(--text);
  font-size: 0.69rem;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.frost-cc-task-flow-track {
  position: relative;
  height: 24px;
  overflow: hidden;
  align-self: start;
  margin-top: 4px;
}
.frost-cc-task-flow-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 8px;
  top: 11px;
  border-top: 1px solid color-mix(in srgb, var(--flow-color) 40%, transparent);
}
.frost-cc-task-flow-row[data-state="requested"] .frost-cc-task-flow-track::before {
  border-top-style: dashed;
}
.frost-cc-task-flow-arrow {
  position: absolute;
  right: 0;
  top: 2px;
  font-size: 15px;
  line-height: 18px;
}
.frost-cc-task-flow-packet {
  display: none;
  position: absolute;
  top: 10px;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent 50%, var(--flow-color) 78%, transparent 96%);
}
.frost-cc-task-flow[data-stale="false"] .frost-cc-task-flow-row[data-state="active"] .frost-cc-task-flow-packet {
  display: block;
  animation: frost-task-handoff 1.8s linear infinite;
}
.frost-cc-task-flow-state {
  grid-column: 1 / -1;
  padding-top: 5px;
  font: 500 0.61rem var(--font-mono);
  text-align: center;
}
.frost-cc-task-flow-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.61rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.frost-cc-task-flow[data-stale="true"] .frost-cc-task-flow-state::after { content: " · last observed"; }
@keyframes frost-task-handoff {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@container (max-width: 240px) {
  .frost-cc-task-flow { padding: 8px 6px; }
  .frost-cc-task-flow-row { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .frost-cc-task-flow .frost-cc-task-flow-packet { display: none !important; animation: none !important; }
}

.frost-cc-agent-tasks .frost-cc-act-head {
  align-items: center;
}

.frost-cc-agent-tasks .frost-status-dot {
  flex: 0 0 auto;
}

.frost-cc-agent-tasks .frost-cc-act-label {
  flex: 1;
  min-width: 0;
}

.frost-cc-agent-tasks .frost-cc-act[data-group="attention"] {
  border-color: color-mix(in srgb, var(--frost-status-issue, #fbbf24) 34%, var(--border));
}

.frost-cc-task-approval {
  margin: 0.55rem 0 0;
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.4;
}

.frost-cc-task-approval-field {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: 8px;
  margin-top: 0.4rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.frost-cc-task-approval-field strong {
  color: var(--muted);
}

.frost-cc-task-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 0.55rem;
}

.frost-cc-task-actions button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-control, var(--card-bg));
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.frost-cc-task-actions button:first-child {
  border-color: color-mix(in srgb, var(--accent2) 45%, var(--border));
}

.frost-cc-task-actions button:last-child {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}

.frost-cc-task-actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.frost-cc-task-actions button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.frost-cc-panel {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.frost-cc-widget {
  container-type: inline-size;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.frost-cc-widget:hover {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
}

.frost-cc-widget-heading {
  min-height: 23px;
  padding-right: 118px;
  justify-content: flex-start;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.frost-cc-widget-heading:active {
  cursor: grabbing;
}
.frost-cc-widget-grip {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: var(--accent);
  opacity: 0.72;
  cursor: grab;
}
.frost-cc-widget-heading:active .frost-cc-widget-grip { cursor: grabbing; }
.frost-cc-visual-widget .frost-cc-widget-heading { padding-right: 145px; }

.frost-cc-widget.is-dragging {
  opacity: 0.48;
  border-color: color-mix(in srgb, var(--accent) 72%, var(--border));
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 16%, transparent);
}

.frost-cc-surface.is-widget-dragging,
.frost-cc-surface.is-widget-dragging * {
  -webkit-user-select: none;
  user-select: none;
}

.frost-cc-widget-controls {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 3px;
}

.frost-cc-widget-control {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border) 86%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    color 140ms ease,
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

.frost-cc-widget-control:hover,
.frost-cc-widget-control:focus-visible {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  background: color-mix(in srgb, var(--accent) 9%, var(--card-bg));
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 18%, transparent);
  outline: none;
}
.frost-cc-widget-control svg {
  width: 14px;
  height: 14px;
}

@container (max-width: 280px) {
  .frost-cc-widget .frost-cc-widget-heading,
  .frost-cc-visual-widget .frost-cc-widget-heading {
    min-height: 23px;
    padding-right: 62px;
  }

  .frost-cc-visual-widget .frost-cc-widget-heading {
    padding-right: 91px;
  }
}

.frost-cc-widget.is-minimized {
  min-height: 42px;
  padding-top: 14px;
  padding-bottom: 12px;
}

.frost-cc-widget.is-minimized > :not(.frost-cc-widget-heading):not(.frost-cc-widget-controls) {
  display: none;
}

.frost-cc-widget.is-minimized .frost-cc-widget-heading {
  min-height: 15px;
  margin-bottom: 0;
}

.frost-cc-widget.is-minimized .frost-cc-weather-head > :not(.frost-cc-title) {
  display: none;
}

/* --------------------------------------------------------------------------
   The empty conversation (addendum 441).

   Measured before this rule existed: roughly half the viewport height was blank
   between the greeting and the composer, with the greeting pinned to the top of
   a 1032px region. The layout was CORRECT -- an empty conversation genuinely
   has nothing in it -- but "correct" and "designed" are different claims, and
   441 asks for the second one.

   The fix is not to add content. There is nothing true to put there, and a row
   of suggested prompts would be invented copy dressed as a feature. Instead the
   emptiness is composed: the greeting centres in the region it occupies, so it
   reads as a deliberate resting state rather than as a list that failed to
   load. Same bytes, same information, no fabrication.

   Keyed on the absence of a user message rather than on a child count, because
   that is what "the conversation has not started" actually means -- and it
   survives the greeting being one bubble or three. The moment the owner sends
   anything the rule stops matching and the transcript goes back to growing from
   the top, which is the correct behaviour for a log.
   -------------------------------------------------------------------------- */
.frost-cc-active .frost-cc-main > .frost-panel .frost-messages:not(:has(.frost-msg-user)) {
  justify-content: center;
}

/* A touch more presence while it is the only thing on screen. This is the same
   greeting, not a different one -- it simply stops looking like a stray line at
   the top of an empty box. */
.frost-cc-active .frost-cc-main > .frost-panel .frost-messages:not(:has(.frost-msg-user)) .frost-msg-assistant {
  align-self: center;
  text-align: center;
  max-width: 46ch;
  font-size: 14px;
  font-weight: 500;
  background: color-mix(in srgb, var(--card-bg) 78%, transparent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--border));
  color: var(--text);
}

.frost-cc-title {
  font-family: var(--font);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

.frost-cc-clock-layout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.frost-cc-clock-phase { color: var(--accent); font-size: .75rem; margin-bottom: 8px; }
.frost-cc-clock-layout .frost-cc-clock-face.is-digital {
  width: auto;
  height: auto;
  flex: none;
  border-radius: 4px;
}
.frost-cc-clock-layout .frost-cc-clock-digital { font-size: clamp(1.7rem, 3vw, 2.8rem); }
.frost-cc-clock-layout .frost-cc-kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.frost-cc-clock-layout .frost-cc-kv dt { display: none; }
.frost-cc-clock-layout .frost-cc-kv dd { margin: 0; }

.frost-cc-clock-face {
  display: grid;
  place-items: center;
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.frost-cc-clock-face:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.frost-cc-clock-face.is-digital .frost-cc-analog-clock { display: none; }
.frost-cc-clock-digital {
  display: none;
  font-family: var(--font-mono);
  font-size: 1.12rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  color: var(--text);
  text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 42%, transparent);
}
.frost-cc-clock-face.is-digital .frost-cc-clock-digital { display: block; }
.frost-cc-clock-progress {
  height: 2px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--border));
}
.frost-cc-clock-progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 950ms linear;
  background: linear-gradient(90deg, var(--accent), var(--frost-accent, #ff4f9a));
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.frost-cc-clock-layout .frost-cc-kv dd { font-variant-numeric: tabular-nums; }
.frost-cc-clock-panel {
  background:
    radial-gradient(ellipse at 82% 0%, color-mix(in srgb, #ff9a54 14%, transparent), transparent 44%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 5%, var(--card-bg)), var(--card-bg) 72%);
}

.frost-cc-panel.frost-theme-selector {
  display: grid;
  gap: 8px;
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 58%),
    var(--card-bg);
}
.frost-cc-panel.frost-theme-selector .frost-cc-title { margin-bottom: 0; }
.frost-cc-panel .frost-theme-dial {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 176px);
  aspect-ratio: 1;
  margin: 0 auto 2px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 50%;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--accent) 11%, var(--card-bg)) 0 34%, transparent 35%),
    repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--border) 70%, transparent) 0deg 1deg, transparent 1deg 30deg);
  box-shadow: inset 0 0 28px color-mix(in srgb, var(--accent) 12%, transparent);
}
.frost-cc-panel .frost-theme-orbit {
  position: absolute;
  inset: 50%;
  width: 0;
  height: 0;
}
.frost-cc-panel .frost-theme-choice {
  position: absolute;
  top: -19px;
  left: -19px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  transform: rotate(var(--theme-angle)) translateY(-66px) rotate(var(--theme-counter-angle));
  transition: transform 450ms cubic-bezier(.2,.8,.2,1), color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.frost-cc-panel .frost-theme-choice svg { width: 16px; height: 16px; }
.frost-cc-panel .frost-theme-choice.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--card-bg));
  color: var(--accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 42%, transparent);
}
.frost-cc-panel .frost-theme-active {
  z-index: 1;
  max-width: 78%;
  overflow: hidden;
  color: var(--text);
  font-size: 0.83rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frost-cc-panel .frost-theme-active-description {
  position: absolute;
  right: 12%;
  bottom: 21%;
  left: 12%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.59rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frost-cc-panel .frost-theme-section-title {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.frost-cc-panel .frost-theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.frost-cc-panel .frost-theme-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 34px;
  padding: 5px 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 3%, var(--card-bg));
  color: var(--muted);
  font: inherit;
  font-size: 0.62rem;
  cursor: pointer;
}
.frost-cc-panel .frost-theme-option svg { width: 14px; height: 14px; flex: 0 0 14px; }
.frost-cc-panel .frost-theme-option[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--card-bg));
  color: var(--accent);
}
.frost-cc-panel .frost-theme-option:focus-visible,
.frost-cc-panel .frost-theme-choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.frost-cc-panel .frost-theme-status { min-height: 1em; margin: 0; color: var(--muted); font-size: 0.64rem; }

.frost-cc-clock-layout .frost-cc-kv {
  flex: 1;
  min-width: 0;
}

.frost-cc-analog-clock {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, var(--border));
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 58%),
    var(--card-bg);
  box-shadow:
    inset 0 0 16px color-mix(in srgb, var(--accent) 16%, transparent),
    0 0 8px color-mix(in srgb, var(--accent) 42%, transparent),
    0 0 24px color-mix(in srgb, var(--accent) 18%, transparent);
  animation: frost-cc-clock-glow 4s ease-in-out infinite;
}

.frost-cc-clock-mark {
  --clock-mark-length: 4px;
  position: absolute;
  left: calc(50% - 1px);
  top: 4px;
  width: 2px;
  height: var(--clock-mark-length);
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 46%, transparent);
  transform-origin: 1px 32px;
  transform: rotate(var(--clock-mark-angle));
}

.frost-cc-clock-mark-major {
  --clock-mark-length: 7px;
  background: var(--accent);
  box-shadow: 0 0 5px color-mix(in srgb, var(--accent) 75%, transparent);
}

.frost-cc-clock-hand {
  position: absolute;
  left: calc(50% - 1px);
  bottom: 50%;
  width: 2px;
  border-radius: 999px 999px 2px 2px;
  transform-origin: 50% 100%;
}

.frost-cc-clock-hour {
  height: 18px;
  width: 3px;
  left: calc(50% - 1.5px);
  background: var(--text);
  box-shadow: 0 0 6px color-mix(in srgb, var(--text) 50%, transparent);
}

.frost-cc-clock-minute {
  height: 25px;
  background: color-mix(in srgb, var(--accent) 75%, var(--text));
  box-shadow: 0 0 7px color-mix(in srgb, var(--accent) 70%, transparent);
}

.frost-cc-clock-second {
  height: 28px;
  width: 1px;
  left: calc(50% - 0.5px);
  background: var(--frost-accent, #ff4f9a);
  box-shadow: 0 0 8px color-mix(in srgb, var(--frost-accent, #ff4f9a) 80%, transparent);
}

.frost-cc-clock-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 2px solid var(--card-bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 75%, transparent);
  transform: translate(-50%, -50%);
}

@keyframes frost-cc-clock-glow {
  0%, 100% {
    filter: brightness(0.92);
  }
  50% {
    filter: brightness(1.12);
  }
}

.frost-cc-weather {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(145deg,
      color-mix(in srgb, var(--accent) 10%, var(--card-bg)),
      var(--card-bg) 58%,
      color-mix(in srgb, var(--frost-accent, #ff4f9a) 8%, var(--card-bg)));
}

.frost-cc-weather::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -45% -20%;
  background:
    radial-gradient(circle at 28% 42%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 28%),
    radial-gradient(circle at 72% 60%, color-mix(in srgb, var(--frost-accent, #ff4f9a) 13%, transparent), transparent 24%);
  animation: frost-cc-weather-drift 12s ease-in-out infinite alternate;
}

[data-visual-mode="eco"] .frost-cc-active .frost-cc-widget,
[data-visual-mode="eco"] .frost-cc-active .frost-cc-widget *,
[data-visual-mode="eco"] .frost-cc-active .frost-cc-widget::before,
[data-visual-mode="eco"] .frost-cc-active .frost-cc-widget::after {
  animation: none !important;
  transition-duration: 0.01ms !important;
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}
[data-visual-mode="balanced"] .frost-cc-active .frost-cc-widget {
  box-shadow: none;
}

.frost-cc-weather-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.frost-cc-weather-head .frost-cc-title {
  margin-bottom: 0;
}

.frost-cc-weather-freshness {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 999px;
  color: color-mix(in srgb, var(--accent) 70%, var(--text));
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.frost-cc-weather-freshness[data-stale='true'] {
  color: var(--muted);
  border-color: var(--border);
}

.frost-cc-weather-location {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frost-cc-weather-current {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 10px 0 8px;
}

.frost-cc-weather-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  box-shadow:
    inset 0 0 18px color-mix(in srgb, var(--accent) 12%, transparent),
    0 0 18px color-mix(in srgb, var(--accent) 18%, transparent);
  font-size: 2rem;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent) 42%, transparent));
  animation: frost-cc-weather-float 4.5s ease-in-out infinite;
}

.frost-cc-weather-now {
  min-width: 0;
}

.frost-cc-weather-temp {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 650;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 36%, transparent);
}

.frost-cc-weather-condition {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text);
}

.frost-cc-weather-feels {
  margin-top: 2px;
  font-size: 0.65rem;
  color: var(--muted);
}

.frost-cc-weather-metrics {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 0 9px;
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.frost-cc-weather-view {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 6px;
}

.frost-cc-weather-view button {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.frost-cc-weather-view button[aria-pressed='true'] {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--card-bg));
}

.frost-cc-weather-view button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .frost-cc-weather-view button { min-height: 44px; }
}

@media (max-width: 560px) {
  .frost-cc-weather-view button { min-height: 44px; }
}

.frost-cc-weather-unavailable {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.72rem;
}

.frost-cc-weather-forecast {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.frost-cc-weather-day {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card-bg) 80%, transparent);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.frost-cc-weather-day:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--card-bg));
}

.frost-cc-weather-day-name,
.frost-cc-weather-day-temps,
.frost-cc-weather-day-rain {
  font-family: var(--font-mono);
  font-size: 0.57rem;
  white-space: nowrap;
}

.frost-cc-weather-day-name {
  color: var(--muted);
  text-transform: uppercase;
}

.frost-cc-weather-day-icon {
  font-size: 1rem;
  line-height: 1.2;
}

.frost-cc-weather-day-temps {
  color: var(--text);
}

.frost-cc-weather-day-rain {
  color: color-mix(in srgb, var(--accent) 65%, var(--muted));
}

@keyframes frost-cc-weather-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

@keyframes frost-cc-weather-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.06); }
}

/* --------------------------------------------------------------------------
   Header (spec 268-272): voice state, realtime connection, measured latency,
   assistant state.

   One row, because it is a status line and not a dashboard. It sits above the
   conversation rather than below it so it does not compete with the composer,
   which is where the owner's attention is.
   -------------------------------------------------------------------------- */

.frost-cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  flex: 0 0 auto;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.frost-cc-meters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.frost-cc-meter {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.75rem;
}

/* A meter with no measurement does not render.
   `[hidden]` is a UA `display: none`, and the rule above would otherwise
   outrank it and show an empty field -- which reads as a broken readout
   rather than an absent one. */
.frost-cc-meter[hidden] {
  display: none;
}

.frost-cc-meter-k {
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.frost-cc-meter-v {
  color: var(--text);
  font-variant-numeric: tabular-nums;  /* so a changing figure does not jitter
                                          the fields to its right */
}

/* --------------------------------------------------------------------------
   Service rows (spec 260-262).
   -------------------------------------------------------------------------- */

.frost-cc-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 0.8rem;
}

.frost-cc-kv dt {
  color: var(--muted);
  white-space: nowrap;
}

.frost-cc-kv dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;  /* a model id is long and unbroken */
}

/* Something is wrong, and the rail says so in the same place it says
   everything else. Colour is not the only carrier -- the value itself reads
   "unreachable" or "offline" -- so this stays legible without it. */
.frost-cc-kv dd[data-bad] {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   State readout.

   The dot is driven by a data attribute rather than one class per state, so
   adding a state to FrostState.js does not require a matching CSS class to
   avoid an invisible indicator. Unknown states fall through to the muted
   default below, which reads as "something is happening" rather than as
   nothing at all.
   -------------------------------------------------------------------------- */

.frost-cc-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.frost-cc-state::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background var(--frost-cc-dur) var(--frost-cc-ease);
}

.frost-cc-state[data-state="listening"]::before,
.frost-cc-state[data-state="arming"]::before { background: var(--accent2); }
.frost-cc-state[data-state="transcribing"]::before,
.frost-cc-state[data-state="thinking"]::before,
.frost-cc-state[data-state="streaming"]::before,
.frost-cc-state[data-state="synthesizing"]::before,
.frost-cc-state[data-state="executing"]::before { background: var(--accent); }
.frost-cc-state[data-state="speaking"]::before { background: var(--accent3); }
.frost-cc-state[data-state="error"]::before,
.frost-cc-state[data-state="degraded"]::before { background: var(--danger); }

/* Interrupted is not an error and not idle. The user cut Frost off mid-answer,
   which is a normal, deliberate act -- so it must not use --danger, and it must
   not fall through to the neutral idle dot either, because then a barge-in
   would look identical to nothing having happened. A dimmed speaking colour
   says "that answer stopped" while staying in the speaking family. */
.frost-cc-state[data-state="interrupted"]::before {
  background: var(--accent3);
  opacity: 0.45;
}

/* Confirming is the one state whose entire purpose is to ask for something, and
   it used to fall through to the neutral default -- pixel-identical to idle. A
   state that means "I am waiting for you to approve this" rendering exactly like
   "nothing is happening" is a functional defect rather than a polish gap: the
   one moment the interface genuinely needs attention was the moment it looked
   most inert. It gets the warning hue and a slow breath, so it reads as
   outstanding rather than as silence. */
.frost-cc-state[data-state="confirming"]::before {
  background: var(--warn, #ffb020);
  animation: frost-cc-breathe 2.4s ease-in-out infinite;
}

/* The busy family: transcribing, thinking and executing were one colour and no
   other difference, so three quite different waits were indistinguishable. They
   stay in one hue family -- they ARE all "Frost is working" -- and separate on
   a second channel, which is what makes them readable side by side without
   inventing three unrelated colours.

   Transcribing is turning sound into text: bounded, fast, and driven by
   something the user just did, so it ticks.
   Thinking is unbounded generation, so it breathes.
   Executing is doing something in the world, so it is solid and unmissable --
   a ring, because that is the one that may have side effects. */
.frost-cc-state[data-state="transcribing"]::before {
  animation: frost-cc-tick 0.9s steps(1, end) infinite;
}
.frost-cc-state[data-state="thinking"]::before {
  animation: frost-cc-breathe 1.8s ease-in-out infinite;
}
.frost-cc-state[data-state="streaming"]::before {
  border-radius: 2px;
  animation: frost-cc-stream 1.1s linear infinite;
}
.frost-cc-state[data-state="synthesizing"]::before {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  animation: frost-cc-synthesize 1.2s ease-in-out infinite;
}
.frost-cc-state[data-state="executing"]::before {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  animation: frost-cc-ring 1.4s ease-out infinite;
}

/* Error and degraded shared --danger and nothing else, so a partial outage and
   a hard failure looked the same. Degraded means some of it still works, which
   is a materially different instruction to the owner -- it is hollow rather
   than solid, because something is still running inside it. */
.frost-cc-state[data-state="degraded"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--danger);
}

/* A pulse only while Frost is actually capturing. Animating the dot in every
   state turns it into decoration and it stops carrying information. */
.frost-cc-state[data-state="listening"]::before {
  animation: frost-cc-pulse 1.6s ease-in-out infinite;
}

@keyframes frost-cc-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.82); }
}

/* Distinct from pulse on purpose: pulse changes size and opacity together and
   reads as active capture; breathe is opacity only and reads as waiting. */
@keyframes frost-cc-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* Stepped rather than eased, so it reads as discrete events arriving rather
   than as a continuous process -- which is what transcription is. */
@keyframes frost-cc-tick {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0.3; }
}

@keyframes frost-cc-ring {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  100% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@keyframes frost-cc-stream {
  0% { transform: rotate(0deg) scaleX(0.75); opacity: 0.55; }
  50% { transform: rotate(180deg) scaleX(1); opacity: 1; }
  100% { transform: rotate(360deg) scaleX(0.75); opacity: 0.55; }
}

@keyframes frost-cc-synthesize {
  0%, 100% { transform: scale(0.82); opacity: 0.55; }
  50% { transform: scale(1.18); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Narrow screens (spec 277-278).

   Two steps, because "collapse responsively" and "keep mobile focused on
   conversation" are different instructions and one breakpoint cannot serve
   both.

   Below 900px the rails stop being columns and go under the conversation.
   Below 560px the conversation gets the full first viewport and the movable
   widgets remain available beneath it; horizontal controls disappear because
   both rails are rendered as one stacked flow at that size.
   -------------------------------------------------------------------------- */

.frost-cc-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.frost-cc-catalog-button,
.frost-cc-layout-action,
.frost-cc-layout-delete,
.frost-cc-catalog-close,
.frost-cc-catalog-item button,
.frost-cc-widget-link {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 8%, var(--card-bg));
  color: var(--text);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 140ms ease, background 140ms ease;
}

.frost-cc-catalog-button:hover,
.frost-cc-catalog-button:focus-visible,
.frost-cc-layout-action:hover,
.frost-cc-layout-action:focus-visible,
.frost-cc-layout-delete:focus-visible,
.frost-cc-catalog-close:hover,
.frost-cc-catalog-close:focus-visible,
.frost-cc-catalog-item button:hover,
.frost-cc-catalog-item button:focus-visible,
.frost-cc-widget-link:hover,
.frost-cc-widget-link:focus-visible {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 38%, transparent);
  outline-offset: 2px;
}

.frost-cc-catalog-item button:disabled,
.frost-cc-layout-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.frost-cc-layout-picker { position: relative; }
.frost-cc-layout-menu {
  position: absolute;
  z-index: 25;
  top: calc(100% + 8px);
  right: auto;
  box-sizing: border-box;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(72vh, 620px);
  overflow: auto;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}
.frost-cc-layout-menu[hidden] { display: none; }
.frost-cc-layout-list { display: grid; gap: 7px; }
.frost-cc-layout-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}
.frost-cc-layout-choice,
.frost-cc-layout-delete {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}
.frost-cc-layout-choice {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  text-align: left;
}
.frost-cc-layout-choice[aria-checked="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--card-bg));
}
.frost-cc-layout-choice strong { font-size: 0.82rem; }
.frost-cc-layout-choice span { color: var(--muted); font-size: 0.7rem; }
.frost-cc-layout-delete { padding: 0 9px; color: var(--muted); }
.frost-cc-layout-delete:hover { border-color: var(--accent); color: var(--accent); }
.frost-cc-layout-status { min-height: 1em; margin: 0; color: var(--muted); font-size: 0.72rem; }
.frost-cc-layout-form { display: grid; gap: 8px; }
.frost-cc-layout-form[hidden] { display: none; }
.frost-cc-layout-form label { display: grid; gap: 4px; color: var(--muted); font-size: 0.72rem; }
.frost-cc-layout-form input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
}
.frost-cc-save-layout { width: 100%; }

.frost-cc-catalog-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 64%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: frost-cc-catalog-fade 140ms ease-out;
}

.frost-cc-catalog-backdrop[hidden] {
  display: none;
}

.frost-cc-catalog {
  width: min(680px, 100%);
  max-height: min(760px, calc(100dvh - 48px));
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 180px;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 18px;
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  animation: frost-cc-catalog-enter 160ms ease-out;
}

@keyframes frost-cc-catalog-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes frost-cc-catalog-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.frost-cc-catalog-head {
  position: sticky;
  z-index: 1;
  top: -20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -20px -20px 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.frost-cc-catalog-search {
  display: grid;
  flex: 1 1 100%;
  min-width: 0;
  gap: 6px;
  font-size: 0.875rem;
}

.frost-cc-catalog-search input {
  width: 100%;
  font-size: 1rem;
}

.frost-cc-catalog-head h2,
.frost-cc-catalog-group h3,
.frost-cc-system h3 {
  margin: 0;
}

.frost-cc-catalog-close {
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.5rem;
}

.frost-cc-catalog-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 100%;
  min-height: 44px;
  gap: 8px;
  text-decoration: none;
}

.frost-cc-catalog-settings svg {
  width: 18px;
  height: 18px;
}

.frost-cc-catalog-list,
.frost-cc-catalog-group {
  display: grid;
  gap: 10px;
}

.frost-cc-catalog-list {
  gap: 20px;
}
.frost-cc-catalog-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.frost-cc-catalog-group h3 {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.frost-cc-catalog-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 120px 1fr auto;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  overflow-wrap: anywhere;
}
.frost-cc-catalog-item > button { width: 100%; min-height: 44px; }
.frost-cc-catalog-preview {
  position: relative; min-width: 0; overflow: hidden; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); pointer-events: none;
}
.frost-cc-catalog-preview .frost-cc-preview-content {
  width: 200%; max-width: none; margin: 0; transform: scale(.5); transform-origin: top left;
}
.frost-cc-catalog-preview .frost-cc-widget-heading { padding-right: 0; margin-bottom: 7px; }
.frost-cc-catalog-preview * { animation: none !important; transition: none !important; }
.frost-cc-preview-label {
  position: absolute; bottom: 4px; right: 4px; padding: 3px 5px;
  border-radius: 4px; color: var(--muted); background: var(--surface); font-size: 10px;
}
.frost-cc-preview-scene {
  height: 180px;
  background: radial-gradient(circle at 25% 35%, var(--accent) 0 5px, transparent 6px),
    radial-gradient(circle at 70% 60%, var(--accent) 0 8px, transparent 9px),
    radial-gradient(circle at 50% 20%, var(--accent) 0 4px, transparent 5px),
    radial-gradient(ellipse, color-mix(in srgb, var(--accent) 18%, transparent), transparent);
}
@media (max-width: 360px) {
  .frost-cc-catalog-group { grid-template-columns: minmax(0, 1fr); }
}

.frost-cc-catalog-item strong {
  display: block;
  color: var(--text);
}

.frost-cc-catalog-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.frost-cc-infrastructure-grid {
  display: grid;
  gap: 8px;
}

.frost-cc-system {
  display: grid;
  gap: 6px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.frost-cc-widget-heading,
.frost-cc-system-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.frost-cc-widget-heading:is(h2) { justify-content: flex-start; }

.frost-cc-widget-heading,
.frost-cc-visual-widget .frost-cc-widget-heading {
  margin-bottom: 7px;
}

.frost-cc-widget-heading .frost-cc-title,
.frost-cc-system-heading h3 {
  margin: 0;
}

.frost-cc-system h3,
.frost-cc-section-card > strong {
  font-size: 0.8rem;
}

.frost-cc-resource-list,
.frost-cc-summary,
.frost-cc-section-metrics {
  display: grid;
  gap: 7px;
}

.frost-cc-github {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.frost-cc-github-profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.frost-cc-github-profile-link,
.frost-cc-github-repo-link,
.frost-cc-github-social-link,
.frost-cc-github-metric {
  color: var(--text);
  text-decoration: none;
}

.frost-cc-github-profile-link {
  min-width: 0;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frost-cc-github-social {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.frost-cc-github-social-link {
  color: var(--muted);
  font-size: 0.62rem;
}

.frost-cc-github-profile-link:hover,
.frost-cc-github-repo-link:hover,
.frost-cc-github-social-link:hover,
.frost-cc-github-metric:hover {
  color: var(--accent);
}

.frost-cc-github-profile-link:focus-visible,
.frost-cc-github-repo-link:focus-visible,
.frost-cc-github-social-link:focus-visible,
.frost-cc-github-metric:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.frost-cc-github-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.64rem;
}

.frost-cc-github-repos {
  display: grid;
  max-height: 320px;
  margin: 0;
  padding: 0 3px 0 0;
  gap: 4px;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}

.frost-cc-github-repo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: color-mix(in srgb, var(--card-bg) 82%, var(--accent) 3%);
}

.frost-cc-github-repo-link {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frost-cc-github-metrics {
  display: flex;
  align-items: center;
  gap: 3px;
}

.frost-cc-github-metric {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  min-height: 30px;
  padding: 3px 5px;
  gap: 3px;
  border-radius: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.frost-cc-github-metric-icon {
  color: var(--accent);
  font-size: 0.75rem;
  line-height: 1;
}

.frost-cc-github-empty {
  padding: 8px;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
}

.frost-cc-section-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  color: var(--text);
  text-decoration: none;
}

.frost-cc-section-card:hover,
.frost-cc-section-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 56%, var(--border));
  outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 2px;
}

.frost-cc-section-card span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.frost-cc-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  align-items: start;
  gap: 7px;
}

.frost-cc-section-rings {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.frost-cc-metric {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}

.frost-cc-metric-ring {
  --metric-progress: 0%;
  display: grid;
  width: 48px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--bg2) 94%, transparent) 58%, transparent 60%),
    conic-gradient(from -90deg, var(--accent) 0 var(--metric-progress), color-mix(in srgb, var(--border) 72%, transparent) var(--metric-progress) 100%);
  box-shadow:
    inset 0 0 8px rgba(0, 0, 0, 0.24),
    0 0 9px color-mix(in srgb, var(--accent) 34%, transparent);
  transition: filter 180ms ease, transform 180ms ease;
  animation: frost-cc-metric-glow 2.8s ease-in-out infinite;
}

.frost-cc-metric-ring[data-unavailable='true'] {
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--bg2) 94%, transparent) 58%, transparent 60%),
    repeating-conic-gradient(color-mix(in srgb, var(--border) 78%, transparent) 0 9deg, transparent 9deg 18deg);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.2);
  animation: none;
}

.frost-cc-metric-value {
  color: var(--text) !important;
  font-family: var(--font-mono);
  font-size: var(--widget-text-size, 0.68rem) !important;
  font-weight: 500;
}

.frost-cc-metric-label {
  max-width: 100%;
  color: var(--muted);
  font-size: var(--widget-secondary-size, 0.62rem) !important;
  line-height: 1.5;
  text-align: center;
}

@keyframes frost-cc-metric-glow {
  0%, 100% { filter: brightness(0.96); }
  50% { filter: brightness(1.1); }
}

.frost-cc-resource-head,
.frost-cc-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.72rem;
}

.frost-cc-resource-head span:first-child,
.frost-cc-summary-label {
  color: var(--muted);
}

.frost-cc-resource-head span:last-child,
.frost-cc-summary-value {
  color: var(--text);
  font-family: var(--font-mono);
  text-align: right;
  overflow-wrap: anywhere;
}

.frost-cc-resource-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 76%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 42%, transparent);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.frost-cc-resource-track[data-unavailable='true'] {
  background: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--border) 76%, transparent) 0 4px,
    transparent 4px 8px
  );
}

.frost-cc-resource-fill {
  display: block;
  width: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  box-shadow:
    0 0 8px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 16px color-mix(in srgb, var(--accent2) 18%, transparent);
  transition: width 900ms cubic-bezier(0.4, 0, 0.2, 1);
}

.frost-cc-resource-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  animation: frost-cc-metric-shimmer 2.8s ease-in-out infinite;
}

@keyframes frost-cc-metric-shimmer {
  0% { transform: translateX(-110%); }
  55%, 100% { transform: translateX(110%); }
}

.frost-cc-system-uptime,
.frost-cc-empty-state,
.frost-cc-data-checked {
  color: var(--muted);
  font-size: 0.72rem;
}

.frost-cc-data-checked {
  text-align: right;
}

.frost-cc-system-uptime {
  flex: 0 0 auto;
  text-align: right;
}

.frost-cc-home-assistant {
  padding: 10px;
}

.frost-cc-home-assistant .frost-cc-ha-header,
.frost-cc-home-assistant.frost-cc-widget.is-minimized .frost-cc-ha-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-height: 0;
  padding-right: 0;
  margin-bottom: 6px;
}

.frost-cc-ha-header .frost-cc-title {
  margin: 0;
}

.frost-cc-ha-badges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100px, 100%), 1fr));
  gap: 4px;
}

.frost-cc-ha-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  min-width: 0;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--text);
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease;
}

.frost-cc-ha-badge:hover,
.frost-cc-ha-badge:focus-visible {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: var(--accent);
}

.frost-cc-ha-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.frost-cc-ha-badge svg {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  fill: var(--ha-icon-color, var(--accent));
}

.frost-cc-ha-badge[data-color="blue"] { --ha-icon-color: var(--ha-blue); }
.frost-cc-ha-badge[data-color="amber"] { --ha-icon-color: var(--ha-amber); }
.frost-cc-ha-badge[data-color="red"] { --ha-icon-color: var(--ha-red); }
.frost-cc-ha-badge[data-color="pink"] { --ha-icon-color: var(--ha-pink); }
.frost-cc-ha-badge[data-color="yellow"] { --ha-icon-color: var(--ha-yellow); }
.frost-cc-ha-badge[data-color="deep-purple"] { --ha-icon-color: var(--ha-deep-purple); }
.frost-cc-ha-badge.is-unavailable { --ha-icon-color: var(--muted); }

.frost-cc-ha-badge-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.frost-cc-ha-badge-name,
.frost-cc-ha-badge-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  line-height: 1.25;
}

.frost-cc-ha-badge-name { color: var(--muted); }
.frost-cc-ha-badge-value { font-variant-numeric: tabular-nums; }
.frost-cc-ha-status { color: var(--muted); font-size: 0.7rem; white-space: nowrap; }
.frost-cc-ha-status[data-state="live"] { color: var(--accent); }
.frost-cc-ha-greeting { font-size: 0.8rem; margin: 0 0 8px; }
.frost-cc-ha-sentence { font-size: 0.75rem; line-height: 1.5; margin: 6px 0 0; }
.frost-cc-ha-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.frost-cc-ha-footer .frost-cc-ha-status { margin-right: auto; }
.frost-cc-ha-footer .frost-cc-widget-link { margin-top: 0; font-size: 0.7rem; }

@media (prefers-reduced-motion: reduce) {
  .frost-cc-ha-badge { transition: none; }
}

@media (max-width: 560px) {
  .frost-cc-ha-badge { height: 44px; }
}

@media (pointer: coarse) {
  .frost-cc-ha-badge { height: 44px; }
}

.frost-cc-widget-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  text-decoration: none;
}

.frost-cc-widget-link[hidden] {
  display: none;
}

/* Three minimum-width tracks plus gutters cannot fit below this point. Stack
   before the browser is forced to squeeze usable widget rails into slivers. */
@media (max-width: 1120px) {
  .frost-cc-surface,
  .frost-cc-surface.is-widget-dragging,
  .frost-cc-surface.frost-cc-with-left,
  .frost-cc-surface.frost-cc-with-right,
  .frost-cc-surface.frost-cc-with-left.frost-cc-with-right {
    grid-template-columns: 1fr;
    grid-template-rows:
      calc(var(--frost-cc-viewport-height, 100dvh) - var(--frost-cc-nav-offset, 0px) - 48px)
      max-content
      max-content;
    align-content: start;
    overflow-y: auto;
    scrollbar-width: none;
  }

  .frost-cc-surface::-webkit-scrollbar { display: none; }

  /* The conversation stays first. Source order puts the left rail before
     `.frost-cc-main`, which is right for a three-column desktop layout and
     wrong once they stack. */
  .frost-cc-main { order: 0; height: 100%; }
  .frost-cc-rail { order: 1; }

  .frost-cc-rail {
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-right: 0;
    padding-top: 16px;
    max-height: none;
    overflow: visible;
  }

  .frost-cc-rail-left {
    border-right: none;
    padding-right: 0;
  }
}

@media (max-width: 900px) {
  .frost-cc-widget-control {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 560px) {
  .frost-cc-surface,
  .frost-cc-surface.frost-cc-with-left,
  .frost-cc-surface.frost-cc-with-right,
  .frost-cc-surface.frost-cc-with-left.frost-cc-with-right {
    grid-template-rows:
      calc(var(--frost-cc-viewport-height, 100dvh) - var(--frost-cc-nav-offset, 0px) - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
      max-content
      max-content;
  }

  .frost-cc-surface {
    top: calc(var(--frost-cc-viewport-top, 0px) + var(--frost-cc-nav-offset, 0px));
    bottom: auto;
    height: calc(var(--frost-cc-viewport-height, 100dvh) - var(--frost-cc-nav-offset, 0px));
    gap: 10px;
    padding:
      calc(10px + env(safe-area-inset-top, 0px))
      calc(10px + env(safe-area-inset-right, 0px))
      calc(10px + env(safe-area-inset-bottom, 0px))
      calc(10px + env(safe-area-inset-left, 0px));
    overscroll-behavior: contain;
    scroll-snap-type: y proximity;
  }

  .frost-cc-main {
    height: 100%;
    min-height: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .frost-cc-active .frost-cc-main > .frost-panel .frost-panel-mid {
    padding-inline: 10px;
  }

  .frost-cc-active .frost-cc-main > .frost-panel .frost-panel-bottom {
    padding:
      8px
      10px
      calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
  }

  .frost-cc-active .frost-cc-main > .frost-panel .frost-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .frost-cc-active .frost-cc-main > .frost-panel .frost-search-wrap,
  .frost-cc-active .frost-cc-main > .frost-panel .frost-input-box {
    width: 100%;
  }

  .frost-cc-active .frost-cc-main > .frost-panel .frost-search-wrap {
    justify-content: center;
  }

  .frost-cc-active .frost-cc-main > .frost-panel .frost-mic-btn {
    width: 44px;
    height: 44px;
  }

  .frost-cc-rail {
    display: flex;
    max-height: none;
    overflow: visible;
    scroll-snap-align: start;
  }

  .frost-cc-widget-heading {
    min-height: 44px;
    padding-right: 100px;
    margin-bottom: 12px;
  }

  .frost-cc-visual-widget .frost-cc-widget-heading {
    padding-right: 146px;
  }

  .frost-cc-widget-controls {
    top: 9px;
  }

  .frost-cc-widget.is-minimized .frost-cc-widget-heading {
    min-height: 44px;
    margin-bottom: 0;
  }

  .frost-cc-widget-control {
    width: 44px;
    height: 44px;
  }

  .frost-cc-catalog-button,
  .frost-cc-layout-action,
  .frost-cc-catalog-item button,
  .frost-cc-widget-link {
    min-height: 44px;
  }

  .frost-cc-active .frost-search-toggle,
  .frost-cc-active .frost-mcp-toggle,
  .frost-cc-active .frost-send-btn,
  .frost-cc-active .frost-model-select,
  .frost-cc-active .frost-provider-select,
  .frost-cc-active .frost-panel > .frost-close-btn {
    min-height: 44px;
  }

  /* The header wraps to two lines on a phone rather than squeezing the state
     pill, which is the field that has to stay readable. */
  .frost-cc-header {
    min-width: 0;
    align-items: flex-start;
    overflow: hidden;
  }
  .frost-cc-state {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .frost-cc-header-actions {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .frost-cc-header-actions::-webkit-scrollbar { display: none; }
  .frost-cc-meters { min-width: max-content; flex-wrap: nowrap; }

  .frost-cc-catalog-backdrop {
    align-items: end;
    padding: 0;
  }

  .frost-cc-catalog {
    width: 100%;
    max-height: 100dvh;
    min-height: min(82dvh, 680px);
    padding:
      20px
      calc(16px + env(safe-area-inset-right, 0px))
      calc(20px + env(safe-area-inset-bottom, 0px))
      calc(16px + env(safe-area-inset-left, 0px));
    border-radius: 18px 18px 0 0;
  }

  .frost-cc-catalog-head {
    top: -20px;
    margin-inline: calc(-16px - env(safe-area-inset-left, 0px));
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
  }

  .frost-cc-catalog-item {
    grid-template-columns: 1fr;
  }

  .frost-cc-layout-action,
  .frost-cc-catalog-item button {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Stack Pulse.

   The aesthetic brief was "neon and glitchy". The constraint that shapes every
   rule below is that this panel is always on screen while the command centre
   is open, and it exists to report load. A continuous filter animation that
   costs measurable CPU in order to display CPU would be self-defeating, so:

     - motion animates `transform` and `opacity` only, which the compositor can
       run without re-rasterising;
     - the glitch is a ONE-SHOT triggered by a sample arriving, not a loop. It
       lasts 420ms and stops. Nothing moves between samples, because the poll
       is every 30s and motion tracing a path between two points half a minute
       apart would be drawing data that was never measured;
     - `filter` appears once, as a static drop-shadow for the neon glow. It is
       not animated, so it rasterises with the paint rather than per frame.

   `feTurbulence`/`feDisplacementMap`/`feColorMatrix` are deliberately absent.
   -------------------------------------------------------------------------- */

.frost-cc-pulse {
  --frost-cc-pulse-neon: var(--accent, #6cf1ff);
  position: relative;
  isolation: isolate;
  padding: 14px;
  background:
    radial-gradient(ellipse at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    var(--card-bg);
}

.frost-cc-pulse-intro {
  margin: 0 0 12px;
}

.frost-cc-pulse-body {
  display: grid;
  gap: 12px;
}

.frost-cc-pulse-section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
}

.frost-cc-pulse-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-bottom: 10px;
}

.frost-cc-pulse-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.frost-cc-pulse-section-title::before {
  content: '';
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 1px solid var(--muted);
  border-radius: 3px;
  box-shadow: inset 0 0 0 3px var(--card-bg);
  background: var(--muted);
}

.frost-cc-pulse-section[data-reading='measured'] .frost-cc-pulse-section-title::before {
  border-color: var(--accent);
  background: var(--accent);
}

.frost-cc-pulse-section .frost-cc-data-checked {
  margin: 0;
  white-space: nowrap;
}

.frost-cc-pulse-legend {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  margin: 0 0 14px;
}

.frost-cc-pulse-legend > span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.frost-cc-pulse-legend > span::before {
  content: '';
  width: 6px;
  height: 6px;
  border: 1px dashed var(--muted);
  border-radius: 50%;
}

.frost-cc-pulse-legend > [data-reading='measured']::before {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent);
}

.frost-cc-pulse-legend > [data-reading='measured'][data-health='issue']::before {
  border-color: var(--danger);
  background: var(--danger);
  border-radius: 1px;
}

@container frost-widget (min-width: 520px) {
  .frost-cc-pulse-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .frost-cc-pulse-section[data-pulse-feed='vitals'] {
    grid-column: 1 / -1;
  }
}

.frost-cc-pulse-svg {
  display: block;
  width: 100%;
  height: 88px;
  margin: 0 0 7px;
}

.frost-cc-pulse-section .frost-cc-kv {
  gap: 6px 10px;
}

.frost-cc-pulse-frame {
  fill: none;
  stroke: var(--muted);
  stroke-width: 0.5;
  opacity: 0.5;
}

.frost-cc-pulse-node {
  fill: var(--card-bg);
  stroke: var(--muted);
  stroke-width: 0.7;
  stroke-dasharray: 2 2;
}

.frost-cc-pulse-node[data-reading='measured'] {
  stroke: var(--accent);
  stroke-dasharray: none;
}

.frost-cc-pulse-mark {
  fill: var(--frost-cc-pulse-neon);
  filter: drop-shadow(0 0 1.5px var(--frost-cc-pulse-neon));
}

/* Absence, drawn rather than merely worded. A measured zero renders an empty
   band; an unmeasured vital renders this dashed strike, so "idle" and "dead"
   are never the same picture. It carries the muted/danger colour AND a
   distinct shape, so it does not rely on colour alone. */
.frost-cc-pulse-absent {
  stroke: var(--danger);
  stroke-width: 0.8;
  stroke-dasharray: 3 3;
  opacity: 0.75;
}

.frost-cc-pulse-marks[data-reading='absent'] {
  opacity: 0.6;
}

.frost-cc-pulse.is-glitching .frost-cc-pulse-marks[data-reading='measured'] {
  animation: frost-cc-pulse-glitch 420ms steps(4, end) 1;
}

.frost-cc-pulse.is-glitching .frost-cc-pulse-marks[data-reading='measured'] .frost-cc-pulse-mark {
  transform-box: fill-box;
  transform-origin: center;
  animation: frost-cc-pulse-arrival 420ms var(--frost-cc-ease) both;
  animation-delay: calc(var(--pulse-mark-index, 0) * 25ms);
}

.frost-cc-pulse.is-glitching .frost-cc-pulse-node[data-reading='measured'] {
  transform-box: fill-box;
  transform-origin: center;
  animation: frost-cc-pulse-arrival 700ms var(--frost-cc-ease) both;
}

@keyframes frost-cc-pulse-arrival {
  0% { transform: scale(0.75); opacity: 0.35; }
  45% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes frost-cc-pulse-glitch {
  0%   { transform: translate3d(0, 0, 0);      opacity: 1; }
  18%  { transform: translate3d(-0.8%, 0, 0);  opacity: 0.78; }
  42%  { transform: translate3d(1%, 0, 0);     opacity: 0.95; }
  66%  { transform: translate3d(-0.5%, 0, 0);  opacity: 0.86; }
  100% { transform: translate3d(0, 0, 0);      opacity: 1; }
}

/* --------------------------------------------------------------------------
   Reduced motion.

   Everything above transitions or pulses. scene.js already honours this
   preference for the 3D scene; a full-screen interface that fades and pulses
   regardless would undo that the moment the command centre opens.

   Transitions are reduced to a near-zero duration rather than `none` so that
   transitionend handlers, if any are added later, still fire. A handler that
   never runs because the transition was removed is a nasty way to leave an
   element permanently hidden.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .frost-cc-analog-clock,
  .frost-cc-weather::before,
  .frost-cc-weather-icon,
  .frost-cc-active .frost-request-flow-node,
  .frost-cc-active .frost-request-flow-connector::after { animation: none; opacity: 1; transform: none; }
  .frost-cc-active .frost-cc-surface,
  .frost-cc-active .frost-cc-scrim,
  .frost-cc-active .frost-cc-state::before {
    transition-duration: 1ms;
    animation: none;
  }

  .frost-cc-widget,
  .frost-cc-metric-ring,
  .frost-cc-resource-fill,
  .frost-cc-resource-fill::after,
  .frost-cc-catalog-backdrop,
  .frost-cc-catalog,
  .frost-cc-widget-control,
  .frost-cc-catalog-button,
  .frost-cc-layout-action,
  .frost-cc-catalog-item button,
  .frost-cc-widget-link {
    transition-duration: 1ms;
    animation: none;
  }

  .frost-cc-widget.is-context-widget { animation: none; }

  /* The Stack Pulse glitch is pure decoration -- it carries no information
     that the marks and the text rows do not already carry -- so it is removed
     outright rather than shortened. Nothing is lost: the mark count, the
     dashed absence strike and the values themselves are all static, so a
     reduced-motion reader sees exactly the same data, just without the jolt
     when it arrives. */
  .frost-cc-pulse.is-glitching .frost-cc-pulse-marks[data-reading='measured'] {
    animation: none;
  }
  .frost-cc-pulse.is-glitching .frost-cc-pulse-mark,
  .frost-cc-pulse.is-glitching .frost-cc-pulse-node[data-reading='measured'] {
    animation: none;
  }

  /* Killing the animations re-collapses the states that were separated BY
     animation -- arming vs listening, and transcribing vs thinking, each of
     which shares a hue and differs only in how it moves. Turning motion off
     would hand a reduced-motion user the exact ambiguity this section set out
     to remove, and it would do it silently.

     So each animated state gets a static stand-in on a channel that does not
     move. Same information, no motion. */
  .frost-cc-state[data-state="listening"]::before {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent2) 30%, transparent);
  }
  .frost-cc-state[data-state="transcribing"]::before {
    border-radius: 2px;                       /* a square tick, not a dot */
  }
  .frost-cc-state[data-state="thinking"]::before {
    opacity: 0.6;
  }
  .frost-cc-state[data-state="streaming"]::before {
    border-radius: 2px;
    opacity: 0.7;
  }
  .frost-cc-state[data-state="synthesizing"]::before {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  }
  .frost-cc-state[data-state="confirming"]::before {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn, #ffb020) 30%, transparent);
  }
}
.frost-cc-active .frost-cc-agent-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 4px;
  padding: 8px;
  container-type: inline-size;
}

.frost-cc-active .frost-cc-agent-card > * {
  grid-column: 1 / -1;
}

.frost-cc-active .frost-cc-agent-card > .frost-cc-widget-controls {
  position: static;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

.frost-cc-active .frost-cc-agent-card .frost-cc-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  grid-column: 1;
  grid-row: 1;
  gap: 6px;
  min-height: 44px;
  min-width: 0;
  padding: 0;
  margin: 0;
}

.frost-cc-active .frost-cc-agent-card.is-minimized {
  padding: 8px;
}

.frost-cc-active .frost-cc-agent-card .frost-cc-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.frost-cc-active .frost-cc-agent-portrait {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  object-fit: cover;
  object-position: 100% 40%;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.frost-cc-active .frost-cc-agent-portrait[hidden] {
  display: none;
}

.frost-cc-active .frost-cc-agent-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
}

.frost-cc-active .frost-cc-agent-metric {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-content: start;
  gap: 3px 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  min-width: 0;
}

.frost-cc-active .frost-cc-agent-metric svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.frost-cc-active .frost-cc-agent-metric-label {
  font-size: 0.7rem;
  align-self: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.frost-cc-active .frost-cc-agent-metric-value {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  overflow-wrap: anywhere;
  min-width: 0;
}

.frost-cc-active .frost-cc-agent-metric[data-inline="true"] {
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
}

.frost-cc-active .frost-cc-agent-metric[data-inline="true"] svg {
  width: 16px;
  height: 16px;
}

.frost-cc-active .frost-cc-agent-metric[data-inline="true"] .frost-cc-agent-metric-value {
  grid-column: auto;
  text-align: right;
}

.frost-cc-active .frost-cc-agent-briefing {
  grid-column: 1 / -1;
}

.frost-cc-active .frost-cc-agent-briefing .frost-cc-agent-metric-value {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 400;
}

.frost-cc-active .frost-cc-agent-metric[data-state="unavailable"] svg {
  color: var(--muted);
}

.frost-cc-active .frost-cc-agent-metric[data-state="partial"] svg {
  color: var(--warn, #ffb020);
}

.frost-cc-active .frost-cc-agent-refresh {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  color: var(--muted);
}

.frost-cc-active .frost-cc-agent-refresh[data-state="updating"] {
  color: var(--accent);
}

.frost-cc-active .frost-cc-agent-refresh[data-state="partial"] {
  color: var(--frost-status-issue);
}

.frost-cc-browser-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.frost-cc-browser-launch {
  margin-top: 8px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--frost-status-ok);
  background: var(--surface);
  cursor: pointer;
  touch-action: manipulation;
}

.frost-cc-browser-launch svg { width: 24px; height: 24px; }
.frost-cc-browser-launch:hover { border-color: currentColor; }
.frost-cc-browser-launch:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.frost-cc-browser-launch-play { animation: frost-launch-breathe 2s ease-in-out 2; }
.frost-cc-browser-launch:hover .frost-cc-browser-launch-play,
.frost-cc-browser-launch:focus-visible .frost-cc-browser-launch-play {
  animation: frost-launch-breathe 1.6s ease-in-out 2;
}
@keyframes frost-launch-breathe {
  50% { opacity: .5; transform: translateX(1px); }
}
@media (prefers-reduced-motion: reduce) {
  .frost-cc-browser-launch .frost-cc-browser-launch-play { animation: none; }
}

.frost-cc-active .frost-cc-agent-links {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin-top: 6px;
}

.frost-cc-active .frost-cc-agent-product {
  min-width: 0;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.frost-cc-active .frost-cc-agent-product-title {
  margin: 0 0 5px;
  font-size: 0.78rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.frost-cc-active .frost-cc-agent-report {
  min-width: 0;
  padding: 6px;
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.frost-cc-active .frost-cc-agent-report + .frost-cc-agent-report {
  margin-top: 6px;
}

.frost-cc-active .frost-cc-agent-report:is([data-state="partial"], [data-state="stale"]) {
  border-left-color: var(--warn, #ffb020);
}

.frost-cc-active .frost-cc-agent-report[data-state="unverified"] {
  border-left-color: var(--muted);
}

.frost-cc-active .frost-cc-agent-report-heading,
.frost-cc-active .frost-cc-agent-coverage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 0.68rem;
}

.frost-cc-active .frost-cc-agent-report-state,
.frost-cc-active .frost-cc-agent-report-date,
.frost-cc-active .frost-cc-agent-note {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.frost-cc-active .frost-cc-agent-headline {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 5px 0;
  font-size: 0.74rem;
  line-height: 1.4;
}

.frost-cc-active .frost-cc-agent-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(90px, 100%), 1fr));
  gap: 5px;
  margin: 6px 0;
}

.frost-cc-active .frost-cc-agent-kpis :is(dt, dd) {
  margin: 0;
  overflow-wrap: anywhere;
}

.frost-cc-active .frost-cc-agent-kpis dt {
  font-size: 0.65rem;
  color: var(--muted);
}

.frost-cc-active .frost-cc-agent-kpis dd {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.frost-cc-active .frost-cc-agent-coverage {
  margin-top: 5px;
}

.frost-cc-active .frost-cc-agent-coverage meter {
  flex: 1 1 65px;
  min-width: 0;
  width: 65px;
  height: 10px;
  accent-color: var(--accent);
}

.frost-cc-active .frost-cc-agent-report-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
}

.frost-cc-active .frost-cc-agent-followup {
  margin-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.frost-cc-active .frost-cc-agent-followup > summary {
  min-height: 44px;
  padding: 6px 0;
  box-sizing: border-box;
  cursor: pointer;
  align-content: center;
}

.frost-cc-active .frost-cc-agent-followup-body {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.frost-cc-active .frost-cc-agent-followup textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.4;
}

.frost-cc-active .frost-cc-agent-technical {
  margin-top: 5px;
  font-size: 0.68rem;
}

.frost-cc-active .frost-cc-agent-technical[hidden] {
  display: none;
}

.frost-cc-active .frost-cc-agent-technical > summary {
  min-height: 44px;
  align-content: center;
  cursor: pointer;
  color: var(--muted);
}

.frost-cc-active .frost-cc-agent-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  padding: 5px 0;
  border-top: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.frost-cc-active .frost-cc-agent-source-row > strong {
  font-weight: 400;
}

.frost-cc-active .frost-cc-agent-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.frost-cc-active .frost-cc-agent-footer .frost-cc-data-checked {
  margin: 0;
  margin-left: auto;
  font-size: 0.65rem;
}

.frost-cc-active .frost-cc-agent-card .frost-cc-empty-state {
  margin: 0;
  font-size: 0.65rem;
}

.frost-cc-active .frost-cc-agent-card .frost-cc-empty-state:empty {
  display: none;
}

.frost-cc-active .frost-cc-agent-board {
  flex: 0 0 44px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.frost-cc-active .frost-cc-agent-board:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.frost-cc-active .frost-cc-agent-card .frost-cc-widget-link {
  min-height: 44px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 0.7rem;
  white-space: normal;
  text-align: left;
}

.frost-cc-active .frost-cc-agent-footer .frost-cc-widget-link {
  order: 1;
}

.frost-cc-active .frost-cc-agent-footer .frost-cc-agent-board {
  order: 2;
}

.frost-cc-active .frost-cc-agent-card .frost-cc-widget-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@container (max-width: 320px) {
  .frost-cc-active .frost-cc-agent-card .frost-cc-title {
    gap: 4px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
  }

  .frost-cc-active .frost-cc-agent-portrait {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .frost-cc-active .frost-cc-agent-metric[data-inline="true"] {
    grid-column: 1 / -1;
  }

  .frost-cc-active .frost-cc-agent-metric-value {
    font-size: 0.76rem;
    line-height: 1.3;
  }
}
