@font-face {
  font-family: "Cinzel";
  src: url("./fonts/cinzel.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel Fallback";
  src: local("Palatino Linotype"), local("Palatino"), local("Georgia");
  ascent-override: 97.6%;
  descent-override: 37.2%;
  line-gap-override: 0%;
}

/* Skin-independent tokens. Colours, surfaces, radius and the display font come from
   the active skin (web/skins/<id>/skin.css), so they are not declared here; the logo treatment, terminal and icons below never change with a skin. */
:root {
  --wordmark: linear-gradient(180deg, #a77a26 0%, #7a5715 55%, #563c0b 100%);
  --term-bg: #0f1115;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font-brand: "Cinzel", "Cinzel Fallback", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2.5v2.2M12 19.3v2.2M2.5 12h2.2M19.3 12h2.2M5.3 5.3l1.6 1.6M17.1 17.1l1.6 1.6M5.3 18.7l1.6-1.6M17.1 6.9l1.6-1.6'/%3E%3C/svg%3E");
  --icon-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M19.5 14.6A8 8 0 0 1 9.4 4.5a8 8 0 1 0 10.1 10.1z'/%3E%3C/svg%3E");
  --icon-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21'/%3E%3C/svg%3E");
  --icon-power: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 3v8.5'/%3E%3Cpath d='M7 6.2a7.5 7.5 0 1 0 10 0'/%3E%3C/svg%3E");
  --icon-sound: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9.5h3.5L12 5.5v13l-4.5-4H4z'/%3E%3Cpath d='M15.5 9a4.2 4.2 0 0 1 0 6M18.3 6.5a8 8 0 0 1 0 11'/%3E%3C/svg%3E");
  --icon-external:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E");
  --icon-cloud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M7 18.5h10.5a4 4 0 0 0 .6-7.96A6 6 0 0 0 6.5 9.6 4.5 4.5 0 0 0 7 18.5z'/%3E%3C/svg%3E");
  --icon-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 5.5l6.5 6.5L9 18.5'/%3E%3C/svg%3E");
  --icon-github: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z'/%3E%3C/svg%3E");
  --icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 10.8v6.2' stroke-width='2.4'/%3E%3Ccircle cx='12' cy='7.3' r='1.2' fill='black' stroke='none'/%3E%3C/svg%3E");
  --icon-grip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='9' cy='5.5' r='1.9'/%3E%3Ccircle cx='15' cy='5.5' r='1.9'/%3E%3Ccircle cx='9' cy='12' r='1.9'/%3E%3Ccircle cx='15' cy='12' r='1.9'/%3E%3Ccircle cx='9' cy='18.5' r='1.9'/%3E%3Ccircle cx='15' cy='18.5' r='1.9'/%3E%3C/svg%3E");
  --icon-gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z'/%3E%3C/svg%3E");
  --icon-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 6.5h16M4 12h16M4 17.5h16'/%3E%3C/svg%3E");
  --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6.5 6.5l11 11M17.5 6.5l-11 11'/%3E%3C/svg%3E");
  --icon-split: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3.5' y='4.5' width='17' height='15' rx='2'/%3E%3Cpath d='M12 4.5v15'/%3E%3C/svg%3E");
  --icon-server: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='7' rx='1.5'/%3E%3Crect x='4' y='13' width='16' height='7' rx='1.5'/%3E%3Cpath d='M7.5 7.5h.01M7.5 16.5h.01'/%3E%3C/svg%3E");
  --icon-notes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4.5h14v9.5l-5.5 5.5H5z'/%3E%3Cpath d='M13.5 19.5V14H19M8.5 9h7M8.5 12.5h4'/%3E%3C/svg%3E");
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  color-scheme: light;
  scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}

/* theme.js sets data-theme and data-skin from the saved choice or the system setting before the first paint. */
:root[data-theme="dark"] {
  --wordmark: linear-gradient(180deg, #fbe9bd 0%, #e2b867 55%, #a97b35 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }
h1, h2 { margin: 0; font-family: var(--font-display); color: var(--heading); }
h1 {
  font-family: var(--font-brand); font-size: 1.32rem; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
  background: var(--wordmark); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
h2 { font-size: 1.02rem; font-weight: 600; letter-spacing: 0.03em; }
h2 .count { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: 0; }
code, pre { font-family: var(--font-mono); }
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand::before {
  content: ""; width: 34px; height: 34px; flex: none;
  background: url("./brand/crest.png") center / contain no-repeat;
}
.version {
  position: relative; font-family: inherit; font-size: 0.72rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); font-variant-numeric: tabular-nums; cursor: pointer;
}
.version:hover { color: var(--text); border-color: var(--muted); }
.version:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.version.unread::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
}
.topbar-end { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; min-width: 0; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; }
.connection .dot { --dot: var(--warn); width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.connection.ok .dot { --dot: var(--ok); }
.connection.down .dot { --dot: var(--danger); }

main { max-width: calc(1200px + var(--dock-space, 0px)); margin: 0 auto; padding: 26px calc(16px + var(--dock-space, 0px)) 56px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 34px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.count { color: var(--muted); font-weight: 500; }

.cwd { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; flex: 1 1 280px; max-width: 520px; }
.cwd input, .auth input {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem;
}
.cwd input:focus, .auth input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.cwd > label { flex: none; }
.cwd-field { position: relative; display: flex; flex: 1; min-width: 0; }
.cwd-field input { width: 100%; padding-right: 76px; }
.cwd-tools { position: absolute; inset: 3px 3px 3px auto; display: flex; gap: 2px; }
.cwd-tool {
  width: 32px; display: grid; place-items: center;
  padding: 0; border: 1px solid transparent; border-radius: max(3px, calc(var(--radius) - 3px));
  background: transparent; color: var(--muted); cursor: pointer;
}
.cwd-tool:hover:not(:disabled), .cwd-tool:focus-visible {
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}
.cwd-tool:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.cwd-tool:active:not(:disabled) { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.cwd-tool:disabled { opacity: 0.4; cursor: default; }
.cwd-tool[aria-busy="true"] { opacity: 0.7; cursor: progress; }
@media (pointer: coarse) {
  .cwd-field input { min-height: 46px; padding-right: 94px; }
  .cwd-tools { inset: 1px 1px 1px auto; gap: 0; }
  .cwd-tool { width: 44px; }
}

.providers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.provider {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.provider-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.provider.unavailable .provider-icon { filter: grayscale(1); opacity: 0.45; }
.provider-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.provider .vendor-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.provider .vendor { font-weight: 600; }
.provider .tier {
  font-size: 0.68rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; max-width: 100%;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.provider .tool { color: var(--muted); font-size: 0.85rem; }
.provider .state { font-size: 0.75rem; color: var(--ok); }
.provider .state.update-available { color: var(--warn); }
.provider.unavailable .state { color: var(--muted); }
.provider .update { color: var(--warn); border-color: var(--warn); }
.provider .accounts, .provider .shells { display: flex; flex-wrap: wrap; gap: 6px; }
.account-chip {
  font: inherit; font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-chip:hover { border-color: var(--muted); }
.account-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.account-chip[aria-selected="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-text); }
.account-chip.unsigned { border-style: dashed; }
.provider .usage { display: grid; gap: 4px; }
.provider .usage:empty { display: none; }
/* Spent portrait: the art stills and a danger wash sits inside the frame. The card stays usable. */
.provider .spent-veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 28%, color-mix(in srgb, var(--danger) 46%, transparent) 100%),
    linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 52%);
  transition: opacity 0.4s var(--ease);
}
.provider.spent .card-art::before { filter: grayscale(1) brightness(0.82); }
.provider.spent .spent-veil { opacity: 1; }
.environment-summary { min-width: 0; font-size: .78rem; }
.environment-open { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-align: left; }
.environment-open:hover { text-decoration: underline; }
.environment-open:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.environment-values { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px; margin: 6px 0; }
.environment-values:empty { display: none; }
.environment-values dt { color: var(--muted); }
.environment-values dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.environment-note { margin: 4px 0 0; color: var(--muted); font-size: .72rem; }
.environment-scopes { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.environment-scope {
  font: inherit; font-size: 0.75rem; font-weight: 600; padding: 3px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.environment-scope:hover { border-color: var(--muted); }
.environment-scope:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.environment-scope[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-text); }
.environment-dialog select {
  width: 100%; max-width: 100%; margin: 0 0 8px; padding: 8px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font: inherit;
}
.environment-dialog label { display: block; margin: 8px 0 4px; font-size: 0.8rem; color: var(--muted); }
@media (pointer: coarse), (max-width: 640px) {
  .environment-scope { min-height: 36px; }
  .environment-dialog select { min-height: 44px; }
}
.environment-detail { font-size: .85rem; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.environment-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.environment-row-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.environment-row p { margin: 5px 0; }
.environment-path { display: block; margin-top: 5px; font-size: .8rem; overflow-wrap: anywhere; }
.meter { display: grid; grid-template-columns: 5.5em 1fr auto; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); }
.meter-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.meter.low .meter-fill { background: var(--warn); }
.meter.empty .meter-fill { background: var(--danger); }
.meter-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.usage-note { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider .model-stats {
  display: grid; grid-template-columns: max-content minmax(24px, 1fr) auto; align-items: center; gap: 2px 8px;
}
.provider .model-stats:empty { display: none; }
.provider .model-stats > .usage-note { grid-column: 1 / -1; contain: inline-size; }
.model-stats-head {
  grid-column: 1 / -1; justify-self: start; max-width: 100%; min-height: 24px; padding: 0; border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 0.78rem; text-align: left; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.model-stats-head::after, .console-link::after, .menu-button::after, .model-name::before, .provider .copies summary::before {
  content: ""; display: inline-block; flex: none; width: 0.75em; height: 0.75em; margin-left: 0.3em; vertical-align: -0.05em;
  background: currentColor; mask: var(--icon-chevron) center / contain no-repeat;
}
.console-link::after { content: "\2060"; display: inline; padding-left: 0.7em; margin-left: 0.25em; mask-image: var(--icon-external); }
.model-stats-head:hover { text-decoration: underline; }
.model-stats-head:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.stat {
  --tier: var(--border);
  grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center;
  min-height: 24px; font-size: 0.75rem; color: var(--muted);
}
.stat-label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.stat-reading { grid-column: 2 / -1; display: grid; grid-template-columns: subgrid; align-items: center; }
.info {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 0.9rem; height: 0.9rem; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 0; cursor: help;
}
.info::before { content: ""; position: absolute; inset: 0; background: currentColor; mask: var(--icon-info) center / contain no-repeat; }
.info::after { content: ""; position: absolute; inset: -6px; }
.info:hover, .info:focus-visible { color: var(--accent); }
.info:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tip {
  position: fixed; z-index: 30; width: max-content; max-width: min(320px, calc(100vw - 16px)); margin: 0; padding: 9px 11px;
  border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.78rem; line-height: 1.45; pointer-events: none;
}
.tip strong { font-weight: 600; }
.tip span { margin-left: 6px; font-size: 0.72rem; opacity: 0.75; }
.tip span::before { content: "· "; }
.tip p { margin: 4px 0 0; }
.stat-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.stat-fill { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--tier); }
.stat-value, .model-index { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-value { justify-content: flex-end; }
.stat-value .level, .model-index .level { min-width: 3ch; text-align: right; }
.stat.unmeasured .stat-value, .model-index.unmeasured { color: var(--muted); }
.stat-note { display: none; }
.stat-tier {
  display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700; line-height: 1;
  color: var(--tier-ink); background: color-mix(in srgb, var(--tier) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tier) 50%, transparent);
}
.tier-s { --tier: #c99a2e; --tier-ink: #7a5200; }
.tier-a { --tier: #8b5cf6; --tier-ink: #5b21b6; }
.tier-b { --tier: #3b82f6; --tier-ink: #1d4ed8; }
.tier-c { --tier: #22a35a; --tier-ink: #166534; }
.tier-d { --tier: #94a3b8; --tier-ink: #475569; }
:where(:root[data-theme="dark"]) {
  .tier-s { --tier: #e0b45c; --tier-ink: #f6dea6; }
  .tier-a { --tier: #a78bfa; --tier-ink: #ddd3ff; }
  .tier-b { --tier: #60a5fa; --tier-ink: #cfe3ff; }
  .tier-c { --tier: #4ade80; --tier-ink: #c6f6d5; }
  .tier-d { --tier: #94a3b8; --tier-ink: #d4dbe4; }
}
.provider-links { display: flex; gap: 14px; font-size: 0.78rem; }
.reporting-row { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--muted); }
.reporting-row .btn { padding: 2px 10px; font-size: 0.75rem; white-space: nowrap; }
.console-link { color: var(--accent); text-decoration: none; }
.console-link:hover { text-decoration: underline; }
.console-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.cloud-link { display: block; flex: none; align-self: flex-start; width: 32px; height: 32px; margin: -4px -6px 0 0; border-radius: 8px; color: var(--muted); }
.cloud-link::before { content: ""; display: block; width: 100%; height: 100%; background: currentColor; mask: var(--icon-cloud) center / 20px no-repeat; }
.cloud-link:hover { color: var(--accent); }
.cloud-link:focus-visible { color: var(--accent); outline: 2px solid var(--focus); outline-offset: 0; }
.provider-actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.provider .hint { font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.provider .copies { font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.provider .copies summary { cursor: pointer; list-style: none; }
.provider .copies.warned summary { color: var(--warn); }
.provider .copies summary::-webkit-details-marker { display: none; }
.provider .copies summary::before { margin: 0 0.3em 0 0; transition: transform 0.15s var(--ease); }
.provider .copies[open] summary::before { transform: rotate(90deg); }
.provider .copies ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.provider .copies li span { display: block; }
.provider .copies .copy-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.provider .copies .copy-name { color: var(--text); min-width: 0; }
.provider .copies .copy-path { font-family: var(--font-mono); font-size: 0.72rem; }
.provider .copies .copy-uninstall { flex: none; padding: 2px 10px; font-size: 0.75rem; }
.provider.busy { opacity: 0.6; pointer-events: none; }

.provider-icon {
  --c: #64748b;
  flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--c); color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em;
  background-size: cover; background-position: center;
}
.provider-icon.has-image { background-color: transparent; }
.provider-icon.small { width: 30px; height: 30px; border-radius: 9px; font-size: 0.85rem; }

.session-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.session-card {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
}
.session-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.session-card.exited .name { color: var(--muted); }
.card-top { display: flex; align-items: center; gap: 12px; }
.card-title { flex: 1; min-width: 0; }
.card-title .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title .meta, .cwd-line { color: var(--muted); font-size: 0.8rem; }
.cwd-line { font-family: ui-monospace, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.status-pill {
  font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.model-pill {
  font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  max-width: 11em; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent);
  border: 0; font-family: inherit; cursor: pointer;
}
.model-pill:hover { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); }
.model-pill:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.model-pill.screen { font-weight: 500; }
.status-pill.active { color: var(--ok); }
.status-pill.active::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; vertical-align: 1px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 6px currentColor; animation: pulse 1.2s ease-in-out infinite;
}
.status-pill.exited { color: var(--danger); }

/* Reordering. The grip ends the name line without making it taller; its hit area grows for a finger. */
.name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.name-row .name { flex: 1; min-width: 0; }
.drag-handle {
  position: relative; flex: none; align-self: stretch; display: grid; place-items: center; width: 24px; margin-right: -4px; padding: 0;
  border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; cursor: grab; opacity: 0.85;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, color 0.15s, background-color 0.15s;
}
.drag-handle::before { content: ""; width: 16px; height: 16px; background: currentColor; mask: var(--icon-grip) center / contain no-repeat; }
/* Grown up and sideways, never down over the id chip on the line below. */
.drag-handle::after { content: ""; position: absolute; inset: -20px -10px 0; }
.session-card:hover .drag-handle, .session-card:focus-within .drag-handle { opacity: 1; }
.drag-handle:hover { color: var(--text); background: color-mix(in srgb, var(--text) 9%, transparent); }
.drag-handle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; opacity: 1; }
/* While a card is carried, the grid's own outline marks the place it will land. */
.session-grid { position: relative; }
.session-grid::before {
  content: ""; position: absolute; left: 0; top: 0; width: var(--slot-w, 0); height: var(--slot-h, 0); translate: var(--slot-x, 0) var(--slot-y, 0);
  border: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 9%, transparent); opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease);
}
.session-grid.reordering::before { opacity: 1; transition: opacity 0.2s var(--ease), translate 0.24s var(--ease); }
.session-grid > .session-card.dragging, .session-grid > .session-card.settling { z-index: 4; transform: none; }
.session-grid > .session-card.dragging {
  scale: 1.03; cursor: grabbing;
  box-shadow: 0 24px 48px -14px rgb(0 0 0 / 0.5), 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: scale 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.session-grid > .session-card.settling { transition: scale 0.24s var(--ease), box-shadow 0.24s var(--ease); }
.session-grid > .session-card.dragging .drag-handle { opacity: 1; color: var(--text); cursor: grabbing; }
:root.reordering, :root.reordering * { cursor: grabbing; user-select: none; -webkit-user-select: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.agents-row { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.agents-label { font-size: 0.75rem; color: var(--muted); }
.agents { display: flex; flex-wrap: wrap; gap: 6px; }
.agents-row .agents { flex: 1; min-width: 0; }
.agents:empty::after { content: attr(data-empty); font-size: 0.75rem; color: var(--muted); }
.agents.reporting-attention:empty::after { color: var(--warn); }
.reporting-why { align-self: center; padding: 0 6px; border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 0.7rem; cursor: pointer; }
.reporting-why:hover, .reporting-why:focus-visible { color: var(--text); border-color: var(--muted); }
.agent {
  --c: #64748b;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: var(--text);
  border: 2px solid var(--c); font-size: 0.72rem; font-weight: 700;
}
.agent.working::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--c);
  opacity: 0; animation: ring 1.6s ease-out infinite;
}
.agent.waiting { border-style: dashed; }
.agent.done, .agent.idle { opacity: 0.5; }
.panel-title .agents:empty::after { content: none; }
.agent.shell, .agent.monitor { font-family: var(--font-mono, monospace); font-size: 0.8rem; }
.agent-overflow { align-self: center; font-size: 0.75rem; font-weight: 600; color: var(--muted); }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, filter 0.15s, transform 0.1s;
}
.btn:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(1px); }
.btn:hover { border-color: var(--muted); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: progress; }
.menu-button, .notes-open, .github-toggle, .upgrade { white-space: nowrap; }
.settings::before, .manager::before, .notes-open::before, .github-toggle::before, .menu-toggle::before, .btn.split::before, .settings-menu .choice > span::before {
  content: ""; display: inline-block; width: 1em; height: 1em; margin-right: 0.4em; vertical-align: -0.15em;
  background: currentColor; mask: var(--icon-sun) center / contain no-repeat;
}
.settings::before { mask-image: var(--icon-gear); }
.manager::before { mask-image: var(--icon-server); }
.github-toggle::before { mask-image: var(--icon-github); }
.menu-toggle::before { margin: 0; mask-image: var(--icon-menu); }
.btn.split::before { mask-image: var(--icon-split); }
.settings-menu .choice > .mode-dark::before { mask-image: var(--icon-moon); }
.settings-menu .choice > .sound-alerts::before { mask-image: var(--icon-sound); }
.settings-menu .choice > .voice-input::before { mask-image: var(--icon-mic); }
.settings-menu .choice > .autostart::before { mask-image: var(--icon-power); }
.voice-note { margin: 0 8px 6px; max-width: 26ch; color: var(--muted); font-size: 0.75rem; line-height: 1.35; }
.settings-menu .choice > .startup-boot::before { mask-image: var(--icon-server); }
.settings-menu .choice > .startup-off::before, .settings-menu .choice > .view-name::before { visibility: hidden; }
.autostart-run { overflow-wrap: anywhere; }
.autostart-run[data-outcome="failed"] { color: var(--danger); }
.autostart-run[data-outcome="warn"] { color: var(--warn); }
.startup-commands { display: grid; gap: 4px; margin: 0 8px 6px; max-width: 26ch; font-size: 0.75rem; }
.startup-commands .command { align-items: flex-start; }
.startup-commands .command pre { margin: 0; padding: 4px 6px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.startup-commands .btn { padding: 3px 8px; font-size: 0.75rem; }
.notes-open::before { mask-image: var(--icon-notes); }
.notes-open[aria-pressed="true"], .github-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.menu-button::after { margin-left: 0.45em; transform: rotate(90deg); transition: transform 0.15s var(--ease); }
.menu-button:has(+ :popover-open)::after { transform: rotate(-90deg); }
.manager.pending { color: var(--warn); border-color: var(--warn); }
.menu {
  position: fixed; inset: auto; margin: 0; min-width: 190px; padding: 6px; display: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22); font-size: 0.85rem; overflow-y: auto;
}
.menu:popover-open { display: grid; gap: 4px; animation: fade-in 0.12s var(--ease); }
.settings-menu fieldset { margin: 0; padding: 0; border: 0; display: grid; }
.settings-menu fieldset + fieldset { padding-top: 4px; border-top: 1px solid var(--border); }
.settings-menu legend { padding: 6px 8px 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.settings-menu .choice { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: calc(var(--radius) - 2px); cursor: pointer; }
.settings-menu .choice:hover, .settings-menu .choice:has(:focus-visible) { background: var(--surface-2); }
.settings-menu .choice:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.settings-menu .choice input { margin: 0; accent-color: var(--accent-fill); }
.settings-menu .choice:has(:checked) { font-weight: 600; }
#skin-choices .choice > span::before { content: none; }
.menu-item {
  display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: calc(var(--radius) - 2px); background: none;
  color: var(--text); font: inherit; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.menu-item.danger { color: var(--danger); }
.menu-item[aria-current="true"] { font-weight: 600; }
.menu-item .menu-note { display: block; color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; }
.btn.upgrade, .restart-manager.pending { color: var(--warn); border-color: var(--warn); }
.topbar-menu { min-width: 220px; }
.topbar-menu:popover-open { top: calc(var(--topbar-h, 56px) - 4px); right: 8px; max-height: calc(100dvh - var(--topbar-h, 56px) - 8px); }
.topbar-menu:popover-open > .btn { width: 100%; text-align: left; }
@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .topbar-menu {
    position: static; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 0;
    border: 0; background: none; box-shadow: none; overflow: visible; color: inherit; font-size: inherit;
  }
}
.upgrade-note { font-size: 0.85rem; color: var(--warn); }

.empty { color: var(--muted); margin: 8px 0 0; }

body:has(#app[hidden]):has(#auth[hidden]):has(#stopped[hidden])::after {
  content: ""; position: fixed; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px;
  background: url("./brand/crest.png") center / contain no-repeat;
  animation: splash 1.4s ease-in-out infinite alternate;
}

.auth { max-width: 560px; margin: 60px auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: 12px; }
.auth p { margin: 0; color: var(--muted); line-height: 1.5; }
.auth pre { margin: 0; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.auth form { display: flex; gap: 8px; }
.stopped-help { display: grid; gap: 12px; }
.command { display: flex; align-items: center; gap: 8px; }
.command pre { flex: 1; min-width: 0; overflow-x: auto; }
.stopped-help code { color: var(--text); overflow-wrap: anywhere; }
.notice h2 { color: var(--danger); }
.notice.stopping h2, .notice.restarting h2 { color: var(--warn); }
.error { color: var(--danger); min-height: 1.2em; }

.terminal-panel {
  /* Below the top bar, whose bottom edge the page publishes as --topbar-h. */
  position: fixed; inset: max(calc(var(--topbar-h, 52px) + 12px), var(--terminal-viewport-top, 0px)) calc(16px + var(--dock-stage-space, 0px)) calc(16px + var(--terminal-viewport-bottom, 0px)) 16px; z-index: 10; display: flex; flex-direction: column;
  background: var(--term-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.panel-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 16rem; }
.panel-title .title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-title .sub { display: block; color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-switch {
  min-width: 0; padding: 2px 6px; margin: -2px -6px; border: 0; border-radius: 6px; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.panel-switch:hover { background: var(--surface-2); }
.panel-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.panel-switch .title::after {
  content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-left: 0.35em; vertical-align: 0;
  background: currentColor; mask: var(--icon-chevron) center / contain no-repeat; transform: rotate(90deg);
}
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.split, .btn.swap { white-space: nowrap; }
.btn.swap { max-width: 14em; overflow: hidden; text-overflow: ellipsis; }
.session-menu { min-width: 240px; max-width: min(420px, calc(100vw - 16px)); }
.session-menu .menu-empty { margin: 0; padding: 6px 8px; color: var(--muted); }
.terminal-panes {
  --ratio: 0.5;
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
}
.terminal-panes[data-split="columns"] { grid-template-columns: minmax(0, calc(var(--ratio) * (100% - 8px))) 8px minmax(0, 1fr); }
.terminal-panes[data-split="rows"] { grid-template-rows: minmax(0, calc(var(--ratio) * (100% - 8px))) 8px minmax(0, 1fr); }
.terminal-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pane-head { display: none; }
.terminal-panes[data-split] .pane-head {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; font-size: 0.78rem;
  color: #9aa3b2; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.terminal-panes[data-split] .terminal-pane.focused .pane-head { color: #e6e9ef; box-shadow: inset 0 -2px 0 var(--accent); }
.pane-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-close {
  position: relative; flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px;
  background: none; color: inherit; cursor: pointer;
}
.pane-close::before { content: ""; position: absolute; inset: 4px; background: currentColor; mask: var(--icon-close) center / contain no-repeat; }
.pane-close:hover { background: rgba(255, 255, 255, 0.1); }
.pane-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.splitter { position: relative; z-index: 1; touch-action: none; }
.splitter::after { content: ""; position: absolute; inset: 0; background: transparent; transition: background-color 0.15s; }
.splitter:hover::after, .splitter.dragging::after, .splitter:focus-visible::after { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.splitter:focus-visible { outline: none; }
.pane-splitter { background: rgba(255, 255, 255, 0.06); }
@media (pointer: coarse) {
  .pane-splitter::before { content: ""; position: absolute; inset: 0 -10px; }
  .terminal-panes[data-split="rows"] .pane-splitter::before { inset: -10px 0; }
}
.terminal-panes[data-split="columns"] .pane-splitter { cursor: col-resize; }
.terminal-panes[data-split="rows"] .pane-splitter { cursor: row-resize; }
:root.resizing, :root.resizing * { user-select: none; -webkit-user-select: none; }
.btn.voice { white-space: nowrap; }
.btn.voice::before {
  content: ""; display: inline-block; width: 1em; height: 1em; margin-right: 0.35em; vertical-align: -0.15em;
  background: currentColor; mask: var(--icon-mic) center / contain no-repeat;
}
.btn.voice[aria-pressed="true"] { color: var(--danger); border-color: var(--danger); }
.btn.voice[aria-pressed="true"]::before { animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 50% { opacity: 0.35; } }
.voice-preview {
  position: absolute; left: 12px; right: 12px; bottom: 12px; max-height: 30%; overflow-y: auto; z-index: 1;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px);
  background: var(--surface); color: var(--muted); font-size: clamp(0.8rem, 1.6vw, 0.95rem); font-style: italic;
  overflow-wrap: anywhere; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); pointer-events: none;
}
.terminal-host { flex: 1; min-height: 0; padding: 8px 4px 4px 10px; }
.terminal-host > div { height: 100%; }
.terminal-controls {
  flex: none; display: flex; justify-content: center; gap: 4px;
  padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  border-top: 1px solid var(--border); background: var(--surface);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.terminal-controls .terminal-key {
  flex: 1 1 0; min-width: 44px; max-width: 64px; min-height: 48px; padding: 4px;
  font: 600 0.85rem var(--font-mono); touch-action: manipulation;
}
.terminal-key[data-key^="Arrow"] { font-size: 1.3rem; }
.terminal-key[data-key="Enter"] { flex-grow: 1.25; max-width: 80px; }
.terminal-key.pressed:not(:disabled) { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-text); transform: translateY(1px); }
.terminal-key:disabled { cursor: default; }
.terminal-panel:has(.terminal-controls:not([hidden])) .voice-preview { bottom: calc(72px + env(safe-area-inset-bottom)); }
/* A docked keyboard in landscape leaves little height. Keep the session and actions
   available in one header row; Hide still returns to the normal page. */
.terminal-panel[data-compact] { top: var(--terminal-viewport-top, 0px); }
.terminal-panel[data-compact] .panel-bar { flex-wrap: nowrap; gap: 6px; padding: 6px 8px; }
.terminal-panel[data-compact] .panel-title { flex: 1 1 0; }
.terminal-panel[data-compact] :is(.panel-title .sub, .panel-title .agents, .panel-title .provider-icon) { display: none; }
.terminal-panel[data-compact] .panel-actions { flex-wrap: nowrap; gap: 4px; max-width: 65%; overflow-x: auto; }
.terminal-panel[data-compact] .panel-actions .btn { flex: none; }
.terminal-panel[data-compact] #panel-close { position: sticky; right: 0; z-index: 1; box-shadow: -4px 0 0 var(--surface); }
.terminal-copy {
  width: min(880px, calc(100vw - 24px)); height: min(720px, calc(100dvh - 24px));
  max-width: none; max-height: none; padding: 0; overflow: hidden;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.terminal-copy[open] { display: flex; flex-direction: column; }
.terminal-copy::backdrop { background: rgba(15, 17, 21, 0.5); }
.terminal-copy-bar, .terminal-copy-footer { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.terminal-copy-heading { flex: 1; min-width: 0; }
.terminal-copy-heading .sub { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 0.8rem; }
.terminal-copy textarea {
  flex: 1; min-height: 0; width: 100%; resize: none; margin: 0; padding: 14px 16px;
  border: 0; border-block: 1px solid var(--border); border-radius: 0;
  background: var(--term-bg); color: #e6e9ef; font: 14px/1.5 var(--font-mono);
  white-space: pre; user-select: text; -webkit-user-select: text; touch-action: auto; overscroll-behavior: contain;
}
.terminal-copy textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.terminal-copy-footer p { flex: 1; margin: 0; color: var(--muted); font-size: 0.8rem; }
.terminal-copy .btn { min-height: 44px; flex-shrink: 0; }
.terminal-copy .btn:disabled { cursor: default; }
@media (pointer: coarse) {
  /* A drag on the panel would otherwise scroll the page behind it. */
  body:has(#terminal-panel:not([hidden])) { overflow: hidden; }
}
@media (pointer: coarse) and (max-width: 900px) {
  /* Tablets in portrait are wider than the phone layout but still want the whole width. */
  .terminal-panel { inset: max(var(--topbar-h, 56px), var(--terminal-viewport-top, 0px)) 0 var(--terminal-viewport-bottom, 0px); border-radius: 0; }
}

.models {
  width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.models[open] { display: flex; flex-direction: column; }
.models::backdrop { background: rgba(15, 17, 21, 0.5); }
.models-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.models-heading { flex: 1; min-width: 0; }
.models-heading .sub { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; }
/* Content supplies the basis for auto-height dialogs; a zero basis collapses in Safari. */
.models-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 14px 14px; }
.remote-access { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.remote-body { padding: 4px 20px 20px; font-size: 0.9rem; }
.remote-body > p { color: var(--muted); line-height: 1.6; }
.remote-status { padding: 16px; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.remote-status[data-ready="true"] { border-color: var(--ok); }
.remote-status strong { font-size: 1rem; }
.remote-status p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.remote-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.remote-body .btn { min-height: 42px; }
.remote-body a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.remote-body label { display: block; margin: 12px 0 6px; font-size: 0.8rem; }
.remote-body input { width: 100%; min-width: 0; box-sizing: border-box; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.8rem; }
.remote-body input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.remote-body details { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px; }
.remote-body summary { cursor: pointer; color: var(--muted); }
.remote-body .sub { font-size: 0.8rem; color: var(--muted); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.remote-body form .btn { margin-top: 12px; }
.remote-body .remote-error { color: var(--danger); overflow-wrap: anywhere; }
.remote-share, .remote-confirm { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); margin: 14px 0; }
.remote-share p { margin-top: 0; line-height: 1.5; }
.remote-share canvas { display: block; width: min(100%, 260px); height: auto; margin: 16px auto; image-rendering: pixelated; }
.remote-share canvas[hidden] { display: none; }
.remote-share .btn { margin-top: 12px; }
.model-columns, .model-toggle { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 6.5rem) 4.5rem; align-items: center; gap: 8px; }
.model-columns {
  position: sticky; top: 0; z-index: 1; padding: 10px 8px 6px; background: var(--surface);
  border-bottom: 1px solid var(--border); color: var(--muted); font-size: 0.72rem; font-weight: 600;
}
.model-columns span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-columns span:last-child, .model-context { text-align: right; }
.model { border-bottom: 1px solid var(--border); }
.model-head { margin: 0; font: inherit; }
.model-toggle {
  width: 100%; padding: 9px 8px; border: 0; border-radius: 6px; background: none; color: var(--text);
  font: inherit; font-size: 0.85rem; text-align: left; cursor: pointer;
}
.model-toggle:hover { background: var(--surface-2); }
.model-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.model-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.model-name { font-weight: 600; overflow-wrap: anywhere; }
.model-name::before { width: 0.7em; height: 0.7em; margin: 0 0.3em 0 0; background-color: var(--muted); transition: transform 0.15s var(--ease); }
.model-toggle[aria-expanded="true"] .model-name::before { transform: rotate(90deg); }
.model-context { color: var(--muted); font-variant-numeric: tabular-nums; }
.badge {
  font-size: 0.66rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.in-use { --badge: var(--accent); color: color-mix(in srgb, var(--badge) 80%, #000); }
.badge.new { --badge: var(--ok); color: color-mix(in srgb, var(--badge) 72%, #000); }
.badge.expires, .badge.installed { --badge: var(--warn); color: color-mix(in srgb, var(--badge) 62%, #000); }
.badge.in-use, .badge.new, .badge.expires, .badge.installed { border-color: color-mix(in srgb, var(--badge) 45%, transparent); }
:where(:root[data-theme="dark"]) {
  .badge.in-use, .badge.new, .badge.expires, .badge.installed { color: var(--badge); }
}
.model-detail {
  display: grid; grid-template-columns: max-content minmax(48px, 1fr) auto minmax(0, 19em); gap: 14px 10px;
  padding: 4px 8px 16px calc(8px + 1em);
}
.model-group { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; row-gap: 2px; }
.model-group h4, .model-none { grid-column: 1 / -1; }
.model-group h4 { margin: 0 0 2px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.model-detail .stat-note { display: block; font-size: 0.72rem; }
.model-detail .stat-fill { transform-origin: left; animation: stat-fill 0.45s ease-out; }
.model-none { margin: 0; font-size: 0.75rem; color: var(--muted); }
.model-more { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; font-size: 0.78rem; }
.model-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; }
.model-facts div { display: flex; gap: 6px; }
.model-facts dt { color: var(--muted); }
.model-facts dd { margin: 0; }
.models-more { margin-top: 12px; }
.models-note { margin: 14px 0 0; color: var(--muted); }
.models-source { margin: 0; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.75rem; line-height: 1.45; }

.news-latest {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.news-row { display: flex; align-items: baseline; gap: 4px 10px; min-width: 0; padding: 9px 14px; }
.news-row + .news-row { border-top: 1px solid var(--border); }
.news-row .news-link { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-row .badge, .news-row .news-meta { flex: none; }
.news-link { color: var(--text); font-weight: 600; text-decoration: none; }
a.news-link:hover, .news-discussion:hover { text-decoration: underline; }
a.news-link:visited { color: var(--muted); }
.news-link:focus-visible, .news-discussion:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.news-meta { color: var(--muted); font-size: 0.78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.news-panel {
  width: min(460px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0;
  border: 0; border-left: 1px solid var(--border); background: var(--surface); color: var(--text);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.25);
}
.news-panel[open] { display: flex; flex-direction: column; }
.models, .news-panel {
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), overlay 0.22s allow-discrete, display 0.22s allow-discrete;
}
.models:not([open]) { opacity: 0; transform: translateY(12px) scale(0.98); }
.news-panel:not([open]) { opacity: 0; transform: translateX(28px); }
.models::backdrop, .news-panel::backdrop { transition: opacity 0.22s, overlay 0.22s allow-discrete, display 0.22s allow-discrete; }
.models:not([open])::backdrop, .news-panel:not([open])::backdrop { opacity: 0; }
@starting-style {
  .models[open] { opacity: 0; transform: translateY(12px) scale(0.98); }
  .news-panel[open] { opacity: 0; transform: translateX(28px); }
  .models[open]::backdrop, .news-panel[open]::backdrop { opacity: 0; }
}
.news-panel::backdrop { background: rgba(15, 17, 21, 0.4); }
.news-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.news-heading { flex: 1; min-width: 0; }
.news-heading .sub { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; }
.news-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.news-filter {
  font: inherit; font-size: 0.75rem; font-weight: 600; padding: 3px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.news-filter:hover { border-color: var(--muted); }
.news-filter:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.news-filter[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-text); }
.news-body { flex: 1; min-height: 0; overflow: auto; padding: 0 14px 14px; }
.news-fresh { width: 100%; margin-top: 12px; }
.news-day {
  position: sticky; top: 0; z-index: 1; margin: 0; padding: 12px 0 6px; background: var(--surface);
  color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.news-items { list-style: none; margin: 0; padding: 0; }
.news-item { padding: 10px 0; border-top: 1px solid var(--border); }
.news-head { display: flex; align-items: baseline; gap: 6px; }
.news-head .news-link { overflow-wrap: anywhere; }
.news-head .badge { flex: none; margin-left: auto; }
.news-item .news-meta { display: block; margin-top: 3px; }
.news-summary {
  margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.news-discussion { color: inherit; text-decoration: none; }
.news-empty { margin: 14px 0 0; color: var(--muted); }
.news-status { margin: 0; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.news-status span { display: block; }

.changelog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.changelog-actions .btn { flex: 1 1 auto; }
.changelog-list { list-style: none; margin: 0; padding: 0; }
.changelog-release { padding: 14px 0 12px; }
.changelog-release + .changelog-release { border-top: 1px solid var(--border); }
.changelog-release h3 { margin: 0; font-size: 1rem; }
.changelog-release .news-meta { display: block; margin-top: 2px; }
.changelog-type { margin: 10px 0 4px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.changelog-type.breaking { color: var(--danger); }
.changelog-changes { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; list-style: disc; font-size: 0.85rem; line-height: 1.45; overflow-wrap: anywhere; }
.changelog-changes li::marker { color: var(--muted); }
.changelog-changes code { font-size: 0.8rem; padding: 0 4px; border-radius: 4px; background: var(--surface-2); }

.notes-panel .dock-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 14px 14px; }
.notes-text {
  flex: 1; min-height: 8em; margin: 0; padding: 10px 12px; resize: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9rem; line-height: 1.55;
}
.notes-text:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.notes-panel .sub.warn { color: var(--warn); }
/* Room below the status line for the field's focus ring, and for a warning that wraps to two lines. */
.notes-panel .dock-sub { flex-shrink: 0; padding-bottom: 8px; line-height: 1.4; }
@media (pointer: coarse) {
  /* iOS zooms in on a field with smaller text when it takes focus. */
  .notes-text { font-size: 16px; }
}

.history-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px 0; }
.history-tools input[type="search"], .folder-new input {
  flex: 1 1 220px; min-width: 0; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem;
}
.history-tools input:focus-visible, .history-form input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.history-here { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.history-here:has(input:disabled) { opacity: 0.6; cursor: default; }
.history .models-body { padding-top: 6px; }
.history-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px;
  padding: 10px 8px; border-bottom: 1px solid var(--border);
}
.history-main { min-width: 0; }
.history-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row.untitled .history-title { font-weight: 500; color: var(--muted); }
.history-meta { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row.running .history-meta { color: var(--ok); }
.session-id {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; font-size: 0.72rem; padding: 2px 7px;
  border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: copy; white-space: nowrap;
}
.session-id:hover { color: var(--text); border-color: var(--muted); }
.session-id:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.card-title .meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-title .meta-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-form { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--muted); }
.history-form input {
  flex: 1; min-width: 0; padding: 6px 10px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem;
}

.launch-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 1 1 360px; flex-wrap: wrap; max-width: 680px; }
.launch-tools .cwd { max-width: none; }
.github-open { white-space: nowrap; }
.github-open::before {
  content: ""; display: inline-block; flex: none; width: 1em; height: 1em; margin: 0 0.45em 0 0; vertical-align: -0.15em;
  background-color: currentColor; mask: var(--icon-github) center / contain no-repeat;
}
.github-accounts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.github-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.github-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; font-size: 0.8rem; }
.github-avatar {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--c, var(--muted)); color: #fff; font-size: 0.68rem; font-weight: 700;
}
.github-add { padding: 3px 10px; font-size: 0.8rem; }
.github .models-body { flex: 1; min-height: 0; overflow: auto; padding-top: 10px; }
.github-card {
  display: grid; gap: 10px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); font-size: 0.9rem; line-height: 1.45;
}
.github-card h3 { margin: 0; font-size: 1rem; }
.github-card p { margin: 0; }
.github-small { color: var(--muted); font-size: 0.8rem; }
.github-error { color: var(--danger); }
.github-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.github-actions a.btn { text-decoration: none; }
.github-scopes { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: 0.85rem; }
.github-scopes code, .github-card code { font-size: 0.8rem; padding: 0 4px; border-radius: 4px; background: var(--surface); }
.github-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; }
.github-steps li.done { color: var(--ok); }
.github-steps li.done::after { content: " ✓"; }
.github-code { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.github-code-text {
  font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; letter-spacing: 0.12em; padding: 6px 14px;
  border-radius: var(--radius); border: 1px dashed var(--muted); background: var(--surface); color: var(--heading); user-select: all;
}
.github-waiting::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--warn);
  animation: pulse 1.4s ease-in-out infinite;
}
.github-status { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 2px 0 8px; font-size: 0.85rem; }
.github-ready { color: var(--ok); font-weight: 600; }
.github-ready::before { content: "✓ "; }
.github-status-actions { display: flex; gap: 8px; }
.history-tools.github-tools { padding: 0 0 4px; }
.github-repo { grid-template-columns: minmax(0, 1fr) auto; }
.github-repo .history-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.github-repo .repo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.github-repo .repo-owner { color: var(--muted); font-weight: 500; }
.github-repo .badge { flex: none; }
.github-repo.conflict .history-meta { color: var(--warn); }
.github-create { margin-top: 10px; }
.github-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
.github-fields label { display: grid; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.github-fields label.wide { grid-column: 1 / -1; }
.github-fields input, .github-fields select {
  min-width: 0; padding: 6px 10px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem;
}
.github-fields input:focus-visible, .github-fields select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.github-options { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.85rem; }
.github-options label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.github-options label:has(input:disabled) { opacity: 0.6; cursor: default; }
.github .models-note { display: grid; gap: 4px; font-size: 0.85rem; }
.dock .github-accounts { padding: 10px 14px 0; }
.dock .history-form { padding: 10px 14px; }
.dock .models-body { margin: 0; padding: 10px 14px 14px; }
.github-picker { display: flex; align-items: center; gap: 8px; padding: 10px 14px 0; }
.github-combo { position: relative; flex: 1; min-width: 0; }
.github-combo input {
  width: 100%; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; font-weight: 600;
}
.github-combo input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.github-combo input::placeholder { font-weight: 400; }
.github-repo-list {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: min(26rem, 60dvh, var(--picker-room, 26rem)); overflow: auto;
  margin: 0; padding: 4px; list-style: none; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.github-option { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: calc(var(--radius) - 2px); cursor: pointer; }
.github-option[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.github-option:hover { background: var(--surface-2); }
.github-option[aria-selected="true"]:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.github-option .badge { flex: none; }
.github-option-text { flex: 1; min-width: 0; display: grid; }
.github-option-name { font-weight: 600; overflow-wrap: anywhere; }
.github-option-meta { color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.github-option mark { background: none; color: inherit; font-weight: 800; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 2px; }
.github-option-empty { padding: 8px; color: var(--muted); }
.github-picker-note { display: grid; gap: 2px; margin: 0; padding: 6px 14px 0; color: var(--muted); font-size: 0.78rem; overflow-wrap: anywhere; }
.github-picker-note.warn { color: var(--warn); }
.github-views { display: flex; gap: 2px; margin: 10px 14px 0; border-bottom: 1px solid var(--border); container-type: inline-size; }
.github-view {
  position: relative; flex: 1 1 auto; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 8px; margin-bottom: -1px; border: 1px solid transparent; border-radius: var(--radius) var(--radius) 0 0;
  background: none; color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.github-view:hover { color: var(--text); }
.github-view[aria-selected="true"] { color: var(--heading); background: var(--surface-2); border-color: var(--border); border-bottom-color: var(--surface-2); }
.github-view:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.github-view .short { display: none; }
@container (max-width: 440px) {
  .github-view .long { display: none; }
  .github-view .short { display: inline; }
}
#github-branches { overflow-anchor: none; }
.github-branch-filter { display: flex; align-items: center; gap: 6px; }
.github-branch-filter input {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem;
}
.github-branch-filter input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.github-branch .history-title { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.github-branch .github-record-title { min-width: 0; overflow-wrap: anywhere; }
.github-branch-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.github-branch .history-meta { font-family: var(--font-mono, monospace); }
.github-branch > .btn { align-self: start; }
#github-branches-error .btn { margin-left: 6px; }
@media (pointer: coarse) {
  .github-branch-filter input { font-size: 16px; }
  .github-branch > .btn, #github-branches .github-view-tools .btn, .github-branch-filter .btn { min-height: 36px; }
}
.github-outage { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 1; }
.github-outage[hidden] { display: none; }
.github-running { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent); animation: pulse 1.4s ease-in-out infinite; }
.github-body[hidden] { display: none; }
.github-view-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-bottom: 6px; }
.github-view-tools .btn { padding: 4px 10px; font-size: 0.8rem; }
.github-spacer { flex: 1 1 0; }
.github-segment { display: inline-flex; }
.github-segment .btn { border-radius: 0; }
.github-segment .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.github-segment .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; }
.github-segment .btn[aria-pressed="true"] { position: relative; background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-text); }
a.btn.github-out { text-decoration: none; white-space: nowrap; }
a.btn.github-out::after {
  content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-left: 0.3em; vertical-align: -0.05em;
  background: currentColor; mask: var(--icon-external) center / contain no-repeat;
}
.github-view-note { margin: 10px 0; color: var(--muted); font-size: 0.85rem; }
.github-body .github-error { margin: 10px 0; font-size: 0.85rem; overflow-wrap: anywhere; }
.github-record { grid-template-columns: minmax(0, 1fr) auto; }
.github-record .history-title { white-space: normal; overflow-wrap: anywhere; }
.github-record-title { color: inherit; text-decoration: none; }
.github-record-title:hover { text-decoration: underline; }
.github-record-title:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: 2px; }
.github-record .btn { padding: 3px 10px; font-size: 0.8rem; }
.github-running-note { margin: 4px 0 6px; padding: 6px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 0.85rem; }
.github-service-note { margin: 4px 0 6px; padding: 6px 10px; border-radius: var(--radius); color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); font-size: 0.85rem; }
.github-service-note .console-link { color: inherit; text-decoration: underline; }
.github-running-note.on { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.badge.run { --badge: var(--warn); }
.badge.ok { --badge: var(--ok); }
.badge.bad { --badge: var(--danger); }
.badge.run, .badge.ok, .badge.bad { color: color-mix(in srgb, var(--badge) 72%, #000); border-color: color-mix(in srgb, var(--badge) 45%, transparent); }
:where(:root[data-theme="dark"]) {
  .badge.run, .badge.ok, .badge.bad { color: var(--badge); }
}
.github-issue-form .github-fields { grid-template-columns: minmax(0, 1fr); }
.github-issue-form h3, .github-issue-form .github-small, .github .dock-sub { overflow-wrap: anywhere; }
.github-issue-body { min-height: 10em; resize: vertical; padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; line-height: 1.5; }
.github-issue-body:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (pointer: coarse) {
  .github-combo input, .github-issue-body, .github-issue-form input { font-size: 16px; }
}
.toast .toast-action { margin-left: 12px; padding: 2px 10px; background: transparent; box-shadow: none; color: inherit; border-color: currentColor; }

.dock {
  /* Above an on-screen keyboard, which the page publishes as --dock-viewport-*. */
  position: fixed; top: max(var(--topbar-h, 56px), var(--dock-viewport-top, 0px)); right: 0; bottom: var(--dock-viewport-bottom, 0px); z-index: 12; width: var(--dock-w, 420px); max-width: 100vw;
  display: flex; flex-direction: column; background: var(--surface); color: var(--text);
  border-left: 1px solid var(--border); box-shadow: -16px 0 48px rgba(0, 0, 0, 0.25);
}
:root.dock-push .dock { box-shadow: none; }
:root.dock-full .dock { width: 100vw; border-left: 0; }
.dock-splitter { position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; cursor: col-resize; }
.dock-splitter::after { left: 4px; right: 4px; }
:root.dock-full .dock-splitter { display: none; }
@media (pointer: coarse) {
  /* Wider to touch, drawn the same. */
  .dock-splitter { left: -14px; width: 28px; }
  .dock-splitter::after { left: 13px; right: 13px; }
}
.dock-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.dock-tabs { flex: 1; display: flex; gap: 4px; min-width: 0; }
.dock-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid transparent; border-radius: var(--radius);
  background: none; color: var(--muted); font: inherit; font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.dock-tab::before { content: ""; width: 1em; height: 1em; background: currentColor; mask: var(--icon-github) center / contain no-repeat; }
.dock-tab.notes-tab::before { mask-image: var(--icon-notes); }
.dock-tab:hover { color: var(--text); }
.dock-tab[aria-selected="true"] { color: var(--heading); background: var(--surface-2); border-color: var(--border); }
.dock-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dock-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dock-sub { margin: 0; padding: 8px 14px 0; color: var(--muted); font-size: 0.78rem; }
.github .github-accounts { border-bottom: 0; padding-bottom: 0; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20;
  max-width: min(640px, calc(100vw - 32px)); padding: 10px 14px; border-radius: var(--radius);
  background: var(--text); color: var(--bg); font-size: 0.9rem; box-shadow: var(--shadow); white-space: pre-wrap;
}

.toast:not([hidden]) { animation: toast-in 0.25s var(--ease); }
.tip:not([hidden]) { animation: fade-in 0.12s ease-out; }

::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal 0.6s var(--ease); }

@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes ring { 0% { transform: scale(0.85); opacity: 0.8; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes stat-fill { from { transform: scaleX(0); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes splash { from { opacity: 0.3; transform: scale(0.95); } to { opacity: 0.85; transform: scale(1.03); } }
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--reveal-x) var(--reveal-y)); }
  to { clip-path: circle(var(--reveal-r) at var(--reveal-x) var(--reveal-y)); }
}

@media (prefers-reduced-motion: reduce) {
  .status-pill.active::before, .agent.working::after, .model-detail .stat-fill, .toast:not([hidden]), .tip:not([hidden]), .menu:popover-open { animation: none; }
  .model-name::before, .provider .copies summary::before, .menu-button::after, .btn, .models, .news-panel, .models::backdrop, .news-panel::backdrop { transition: none; }
  .github-waiting::before, .github-running, body:has(#app[hidden]):has(#auth[hidden]):has(#stopped[hidden])::after { animation: none; }
  .btn:active:not(:disabled):not([aria-disabled="true"]) { transform: none; }
  .btn.voice[aria-pressed="true"]::before { animation: none; }
  .drag-handle, .session-grid::before, .session-grid.reordering::before,
  .session-grid > .session-card.dragging, .session-grid > .session-card.settling { transition: none; }
  .provider .spent-veil { transition: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .connection .label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .terminal-panel { inset: max(var(--topbar-h, 56px), var(--terminal-viewport-top, 0px)) 0 var(--terminal-viewport-bottom, 0px); border-radius: 0; }
  .session-grid { grid-template-columns: 1fr; }
  .cwd { flex-basis: 100%; }
  .launch-tools { flex-basis: 100%; justify-content: stretch; }
  .launch-tools .github-open { flex: 1 1 auto; }
  .github-fields { grid-template-columns: minmax(0, 1fr); }
  .models { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .model-columns, .model-toggle { grid-template-columns: minmax(0, 1fr) repeat(3, 4.6rem); }
  .model-columns span:last-child, .model-context { display: none; }
  .model-detail { padding-left: 8px; grid-template-columns: max-content minmax(32px, 1fr) auto; }
  .model-detail .stat { padding-bottom: 6px; }
  .model-detail .stat-reading { row-gap: 1px; }
  .model-detail .stat-note { grid-column: 1 / -1; }
  .news-row { flex-wrap: wrap; }
  .news-row .news-link { flex-basis: 100%; white-space: normal; }
  .news-panel { border-left: 0; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; }
  .history-row .session-id { grid-row: 2; justify-self: start; }
  .history-form { flex-wrap: wrap; }
}
/* Installation controls share each skin's card colors and button styles. */
.multiplexers { margin: .6rem 0; }
.multiplexers > summary { cursor: pointer; font-size: .85rem; }
.multiplexer-refresh { margin: .5rem 0; }
.multiplexer-row { padding: .65rem 0; border-top: 1px solid var(--border); }
.multiplexer-row > strong { margin-right: .6rem; }
.multiplexer-note { font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; margin: .4rem 0; }
.multiplexer-row .copies { margin-top: .4rem; }
.multiplexer-row .copy-head { flex-wrap: wrap; }
.multiplexer-row .copy-name { flex: 1 0 100%; }

.cwd-field.single input { padding-right: 40px; }
@media (pointer: coarse) { .cwd-field.single input { min-height: 46px; padding-right: 50px; } }
.folder-browser { width: min(640px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 48px)); }
@media (max-width: 640px) { .folder-browser { width: 100vw; height: 100dvh; } }
.folder-path { gap: 2px 0; font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; font-size: 0.82rem; }
.folder-crumb { min-height: 32px; padding: 2px 6px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.folder-crumb:not(:first-child)::before { content: "›"; margin-right: 6px; color: var(--muted); }
.folder-crumb:hover, .folder-crumb[aria-current] { color: var(--text); }
.folder-crumb:focus-visible, .folder-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.folder-places, .folder-roots { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.folder-places .btn { min-height: 36px; }
.folder-new-open { margin-left: auto; }
.folder-new { flex-wrap: nowrap; }
.folder-new input { flex: 1; min-width: 0; }
.folder-list { display: flex; flex-direction: column; }
.folder-row {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px; border: 0; border-bottom: 1px solid var(--border);
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.folder-row::before { content: ""; flex: none; width: 18px; height: 14px; border: 1.6px solid var(--muted); border-radius: 2px 4px 3px 3px; }
.folder-row:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.folder-row.hidden-folder { color: var(--muted); }
#folder-status.error { color: var(--danger); }
.folder-footer { justify-content: space-between; }
.folder-current { flex: 1; min-width: 0; font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }
.folder-footer .btn { min-height: 42px; }
@media (pointer: coarse), (max-width: 640px) {
  .folder-places .btn, .folder-new .btn, .folder-new input, .folder-footer .btn, #folder-cancel { min-height: 44px; }
}
.cwd-recent {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; margin: 0; padding: 4px; list-style: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.cwd-recent-option {
  display: flex; align-items: center; min-height: 40px; padding: 6px 10px; border-radius: max(3px, calc(var(--radius) - 3px));
  color: var(--text); font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace; font-size: 0.82rem; overflow-wrap: anywhere; cursor: pointer;
}
.cwd-recent-option:hover, .cwd-recent-option[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); }
@media (pointer: coarse), (max-width: 640px) { .cwd-recent-option { min-height: 46px; } }
.cwd-recent.above { top: auto; bottom: calc(100% + 4px); }
