/* LAI — console for a self-hosted model: chat, code, files, live telemetry. */

/* Any author `display` rule outranks the UA stylesheet's [hidden] rule, so an
   element styled `display: flex` ignores the attribute and is always visible.
   Enforce it once here rather than guarding each panel separately. */
[hidden] {
  display: none !important;
}

:root {
  color-scheme: dark;
  --bg: #10121a;
  --panel: #171a24;
  --panel-2: #1e222e;
  --line: #2a2e3b;
  --text: #e8e6df;
  --muted: #8b8fa0;
  --accent: #e0a458;
  --accent-ink: #1c1305;
  --accent-soft: #e0a45822;
  --danger: #e8798a;
  --danger-soft: #e8798a1c;
  --user-bubble: #1c2130;
  --code-bg: #0b0d14;
  --code-text: #dbe2ee;
  --ok: #6bbf8a;
  --ok-soft: #6bbf8a1f;
  --info: #4fa7c9;
  --info-soft: #4fa7c91a;
  --shadow: 0 20px 60px #00000055;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f5f0;
    --panel: #ffffff;
    --panel-2: #edeae1;
    --line: #e2ddd0;
    --text: #201d16;
    --muted: #777263;
    --accent: #b5762a;
    --accent-ink: #ffffff;
    --accent-soft: #b5762a1a;
    --danger: #b3394a;
    --danger-soft: #b3394a16;
    --user-bubble: #edeae1;
    --code-bg: #1b1913;
    --code-text: #eae6d9;
    --ok: #3f9466;
    --ok-soft: #3f94661a;
    --info: #2f86a6;
    --info-soft: #2f86a616;
    --shadow: 0 20px 50px #00000014;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f0;
  --panel: #ffffff;
  --panel-2: #edeae1;
  --line: #e2ddd0;
  --text: #201d16;
  --muted: #777263;
  --accent: #b5762a;
  --accent-ink: #ffffff;
  --accent-soft: #b5762a1a;
  --danger: #b3394a;
  --danger-soft: #b3394a16;
  --user-bubble: #edeae1;
  --code-bg: #1b1913;
  --code-text: #eae6d9;
  --ok: #3f9466;
  --ok-soft: #3f94661a;
  --info: #2f86a6;
  --info-soft: #2f86a616;
  --shadow: 0 20px 50px #00000014;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  /* Icons are plain glyphs (⚙ ⚡ ⬆ …); keep them monochrome, not colour emoji. */
  font-variant-emoji: text;
  height: 100vh;
  /* 100vh on mobile Safari/Chrome is the browser-chrome-hidden height, not the
     actually visible one, so the last ~60-100px (the composer) end up clipped
     by the overflow:hidden below. dvh tracks the real visible viewport,
     including as the on-screen keyboard opens/closes. Kept as a second
     declaration so browsers without dvh support silently keep the vh above. */
  height: 100dvh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 276px;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  font-family: inherit;
}
::selection {
  background: var(--accent-soft);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Sidebar ------------------------------------------------------------ */

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 22px;
}
.mark,
.orb {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  flex: none;
}
.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 17px;
}
.brand strong {
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}
.new-chat,
.primary-button {
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 9px 14px;
  border-radius: 9px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.3;
}
.new-chat:hover,
.primary-button:hover {
  filter: brightness(1.06);
}
.new-chat {
  width: 100%;
  justify-content: flex-start;
  padding: 11px 14px;
  margin-bottom: 16px;
}
.new-chat span {
  font-size: 16px;
}
.primary-nav {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--muted);
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.nav-item > span:first-child {
  width: 16px;
  flex: none;
  text-align: center;
  color: var(--muted);
}
.nav-item > span + span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item:hover {
  background: var(--panel-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
}
.nav-item.active > span:first-child {
  color: var(--accent);
}
.search-box {
  margin: 10px 2px 4px;
}
.search-box input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  outline: 0;
}
.search-box input:focus {
  border-color: var(--accent);
}
.section-title,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}
.section-title {
  margin: 16px 10px 6px;
}
.history {
  overflow: auto;
  flex: 1;
  min-height: 40px;
}
.history-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item:hover {
  background: var(--panel-2);
  color: var(--text);
}
.history-item.active {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 8px;
  display: grid;
  gap: 2px;
}

/* Header -------------------------------------------------------------- */

main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}
header {
  height: 68px;
  flex: none;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
}
.header-title {
  flex: 1;
  min-width: 0;
}
.header-title h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-title small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}
.header-actions {
  align-items: center;
  gap: 6px;
}
.header-actions:not([hidden]) {
  display: flex;
}
.model-select {
  background: var(--panel-2);
  border: 1px solid transparent;
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  max-width: 180px;
  min-width: 0;
  text-overflow: ellipsis;
  margin-right: 6px;
}
.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.svg-icon {
  display: block;
}
#system-prompt-button {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.icon-button:hover {
  background: var(--panel-2);
  color: var(--text);
}
.icon-button.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}
#menu,
.telemetry-toggle {
  display: none;
}

/* Views ---------------------------------------------------------------- */

.view {
  flex: 1;
  min-height: 0;
}
/* Chat is a column: the transcript scrolls, the composer sits below it in
   normal flow - so it can never cover the last message, whatever its height. */
#chat-view {
  display: flex;
  flex-direction: column;
}
.chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 32px max(20px, calc((100% - 720px) / 2)) 24px;
}
.welcome {
  text-align: center;
  margin: 9vh auto 0;
  color: var(--muted);
  max-width: 560px;
}
.welcome .orb {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  margin: 0 auto 18px;
  font-size: 22px;
}
.welcome h2 {
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: 600;
  margin: 6px 0 8px;
}
.welcome p {
  margin: 0;
}
.starter-grid {
  margin: 26px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  text-align: left;
}
.starter-grid button {
  padding: 14px 15px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.starter-grid button:hover {
  border-color: var(--accent);
}
.starter-grid b {
  font-size: 13px;
  font-weight: 600;
}
.starter-grid span {
  color: var(--muted);
  font-size: 12px;
}

/* Messages --------------------------------------------------------------- */

.message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 22px;
  max-width: 720px;
}
.message.user {
  grid-template-columns: minmax(0, 1fr);
}
.message.user .avatar {
  display: none;
}
.message.user .message-body {
  justify-self: end;
  max-width: min(82%, 620px);
  background: var(--user-bubble);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.message .content {
  overflow-wrap: anywhere;
}
.message.user .content {
  white-space: pre-wrap;
}
.message .content p,
.code-output p {
  margin: 0 0 0.8em;
}
.message .content p:last-child,
.code-output p:last-child {
  margin-bottom: 0;
}
.message .content ul,
.message .content ol,
.code-output ul,
.code-output ol {
  margin: 0.35em 0 1em;
  padding-left: 1.4em;
}
.message .content li,
.code-output li {
  margin: 0.3em 0;
}
.message .content h1,
.message .content h2,
.message .content h3,
.message .content h4,
.code-output h1,
.code-output h2,
.code-output h3,
.code-output h4 {
  margin: 1.1em 0 0.4em;
  line-height: 1.25;
}
.message .content h1:first-child,
.message .content h2:first-child,
.message .content h3:first-child {
  margin-top: 0;
}
.message .content code,
.code-output code {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  background: var(--panel-2);
  padding: 0.12em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
}
.message .content pre,
.code-output pre {
  overflow-x: auto;
  margin: 0.8em 0 1em;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--code-bg);
}
.code-block {
  margin: 0.8em 0 1em;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--code-bg);
  overflow: hidden;
}
.code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 5px 8px 5px 13px;
  border-bottom: 1px solid #ffffff14;
  color: var(--muted);
  font-size: 12px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
.code-block-actions {
  display: flex;
  gap: 6px;
}
.copy-snippet,
.download-snippet {
  border: 1px solid #ffffff1c;
  border-radius: 6px;
  background: transparent;
  color: var(--code-text);
  opacity: 0.75;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
}
.copy-snippet:hover,
.download-snippet:hover {
  opacity: 1;
  border-color: var(--accent);
}
.code-block pre {
  margin: 0;
  border: 0;
  border-radius: 0;
}
.message .content pre code,
.code-output pre code {
  padding: 0;
  background: transparent;
  color: var(--code-text);
}
.message .content blockquote,
.code-output blockquote {
  margin: 0.8em 0;
  padding-left: 13px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.message .content a,
.code-output a {
  color: var(--accent);
}
.message .content hr,
.code-output hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.2em 0;
}
.table-wrap {
  overflow-x: auto;
  margin: 0.8em 0;
}
.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93em;
}
.table-wrap th,
.table-wrap td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
}
.table-wrap th {
  background: var(--panel-2);
}
.role-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  min-height: 20px;
}
.role {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.message.user .role-line {
  display: none;
}
.msg-time {
  color: var(--muted);
  font-size: 11px;
}
.msg-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}
.message:hover .msg-actions {
  opacity: 1;
}
.msg-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
}
.msg-actions button:hover {
  background: var(--panel-2);
  color: var(--text);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}
.chip-agent {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}
.chip-skill {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}
.chip-search {
  color: var(--info);
  border-color: var(--info-soft);
  background: var(--info-soft);
}
.chip-file {
  color: var(--muted);
}
.message-footer {
  margin-top: 6px;
}
.meta-bits {
  color: var(--muted);
  font-size: 11px;
}
.stderr-details {
  margin-top: 6px;
}
.stderr-details summary {
  color: var(--danger);
  font-size: 11px;
  cursor: pointer;
}
.stderr-details pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12px;
}
.error-text {
  color: var(--danger);
}
.source-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  max-width: 460px;
}
.source-panel summary {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.source-panel a {
  display: flex;
  gap: 9px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}
.source-panel a:hover {
  background: var(--panel-2);
}
.source-panel a > span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--panel-2);
  font-size: 10px;
  flex: none;
  margin-top: 1px;
}
.source-panel a small {
  color: var(--muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.typing {
  display: inline-flex;
  gap: 3px;
  margin-left: 2px;
}
.typing i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-blink 1s infinite ease-in-out;
}
.typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typing-blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}
.auto-search-note {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--info);
  font-size: 12px;
  margin: 4px 0 10px;
}

/* Composer ----------------------------------------------------------- */

.attachment-tray {
  flex: none;
  padding: 0 max(20px, calc((100% - 720px) / 2)) 8px;
  gap: 6px;
  flex-wrap: wrap;
}
.attachment-tray:not([hidden]) {
  display: flex;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 6px 4px 10px;
  font-size: 12px;
}
.attachment-chip small {
  color: var(--muted);
}
.attachment-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.attachment-chip button:hover {
  background: var(--line);
  color: var(--text);
}
.composer {
  flex: none;
  padding: 4px max(20px, calc((100% - 720px) / 2)) max(16px, env(safe-area-inset-bottom));
}
.composer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 4px 6px;
}
.mode-select {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
#composer-hint {
  color: var(--muted);
  font-size: 11px;
}
.composer-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 4px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 5px;
}
.composer-row:focus-within {
  border-color: var(--accent);
}
.composer-row .icon-button {
  width: 40px;
  height: 40px;
  font-size: 18px;
}
.composer textarea {
  resize: none;
  max-height: 180px;
  min-height: 42px;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 11px 6px;
  font: inherit;
  outline: none;
}
#send {
  width: 40px;
  height: 40px;
  margin: 0;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}
#send:disabled {
  opacity: 0.55;
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 6px 0;
  flex-wrap: wrap;
}
.tool-toggle {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tool-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}
.tool-toggle b {
  font-weight: 600;
  color: var(--text);
}
.tool-toggle.mode-on {
  color: var(--info);
  border-color: var(--info-soft);
  background: var(--info-soft);
}
.tool-toggle.mode-on b {
  color: var(--info);
}
.tool-toggle.mode-off {
  opacity: 0.6;
}
.privacy-note {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

/* ACE-Step music studio ------------------------------------------------ */

.music-view {
  overflow-y: auto;
  padding: 28px max(20px, calc((100% - 1080px) / 2)) 48px;
}
.music-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
}
.music-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 24px;
}
.music-hero h2 {
  margin: 3px 0 0;
  font-size: 21px;
  font-weight: 600;
}
.music-hero p {
  margin: 5px 0 0;
  font-size: 13px;
}
.music-hero p,
.music-card p {
  color: var(--muted);
}
.music-runtime {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.music-runtime i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.music-runtime.ok i { background: var(--ok); }
.music-runtime.off i { background: var(--danger); }
.music-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, .7fr);
  gap: 20px;
  align-items: start;
}
.music-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.music-form {
  gap: 17px;
}
.music-form:not([hidden]) {
  display: grid;
}
.music-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.music-form label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.music-form textarea,
.music-form input,
.music-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  resize: vertical;
  outline: 0;
}
.music-form textarea:focus,
.music-form input:focus,
.music-form select:focus { border-color: var(--accent); }
.music-form details {
  border-top: 1px solid var(--line);
  padding-top: 13px;
}
.music-form summary { color: var(--muted); cursor: pointer; }
.music-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.music-options .wide { grid-column: 1 / -1; }
.music-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.music-actions > button { flex: none; white-space: nowrap; }
.music-actions small { color: var(--muted); font-size: 12px; }
.music-control h3 { font-size: 17px; font-weight: 600; margin: 4px 0; }
.model-switch-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 20px 0;
}
.model-switch-flow span {
  padding: 10px 8px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  font-size: 12px;
}
.model-switch-flow b { color: var(--accent); }
.music-warning {
  padding: 10px;
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 12px;
}
.music-control > button { margin-top: 9px; }
.music-result {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}
.music-result audio { width: 100%; margin: 12px 0 5px; }
.music-result img,
.music-result video {
  width: 100%;
  border-radius: 10px;
  margin: 12px 0 5px;
  display: block;
}
.vision-kind-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.vision-kind-tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.vision-kind-tab:hover { color: var(--text); border-color: var(--accent); }
.vision-kind-tab.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.vision-video-source {
  position: relative;
  border: 1px dashed var(--line);
  border-radius: 10px;
  min-height: 140px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--bg);
}
.vision-video-source img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 900px) {
  .music-grid { grid-template-columns: 1fr; }
  .music-hero { align-items: start; flex-direction: column; }
}

/* Telemetry rail -------------------------------------------------------- */

.telemetry {
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.telemetry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
#telemetry-close {
  display: none;
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.connection i {
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  flex: none;
}
.connection.ok i {
  background: var(--ok);
}
.telemetry-live {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
}
.live-dot.on {
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: live-pulse 1.1s infinite;
}
@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-soft);
  }
  70% {
    box-shadow: 0 0 0 7px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 44px;
  padding: 0 1px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.sparkline i {
  flex: 1;
  min-width: 2px;
  background: var(--line);
  border-radius: 1px 1px 0 0;
  transition: height 0.15s ease-out, background 0.2s;
}
.sparkline i.live {
  background: var(--accent);
}
.readouts {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.readout span {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.readout strong {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  white-space: nowrap;
}
.readout small {
  color: var(--muted);
  font-size: 10px;
  margin-left: -4px;
}
.telemetry .section-title {
  margin: 4px 0 8px;
}
.stats-by-user {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 12px;
}
.stats-by-user-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.stats-by-user-row .who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-by-user-row .who small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.stats-by-user-row .amount {
  text-align: right;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats-by-user-row .amount small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}
.stats-by-model {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 12px;
}
.stats-by-model-row .head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.stats-by-model-row .head span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-by-model-row .head strong {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats-by-model-row .bar {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.stats-by-model-row .bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 3px 0 0 3px;
}
.stats-by-model-row .foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}
/* Agent panel: a full-screen terminal. It covers the app rather than docking
   beside it, so it never fights the telemetry panel for room - and the agent
   keeps running in the background when it is closed. */
.agent-panel {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: var(--bg, #0b0d13);
}
.agent-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.agent-panel-head strong {
  display: block;
  font-weight: 500;
}
.agent-panel-tools {
  display: flex;
  gap: 4px;
  flex: none;
}
.agent-screens {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.agent-screen-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.agent-screen-tab:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
}
.agent-screen-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.agent-screen-tab.unavailable,
.agent-screen-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.agent-count {
  padding: 0 6px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
}
.agent-busy {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: live-pulse 1.1s infinite;
}
.agent-workspace {
  flex: 1;
  min-height: 120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 10px;
}
.agent-terminal {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #0d1017;
  /* Inset shadow instead of border + padding on the .xterm element: the fit
     addon sizes rows from this box's computed (border-box) height and only
     subtracts the terminal's own padding, so any padding/border here would
     make it allocate rows that end up clipped off the bottom. */
  box-shadow: inset 0 0 0 1px var(--line);
}
.agent-files {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.agent-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.agent-files-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  font-size: 12px;
}
.agent-files-list.muted {
  padding: 12px 10px;
}
.agent-dir {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px calc(8px + var(--depth, 0) * 12px);
  color: var(--muted);
  font-size: 11.5px;
  text-transform: none;
}
.agent-dir::before {
  content: "▾";
  font-size: 9px;
  opacity: 0.7;
}
.agent-file {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 5px 8px 5px calc(14px + var(--depth, 0) * 12px);
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.agent-file:hover {
  background: var(--panel-2);
}
.agent-file span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-file small {
  color: var(--muted);
  font-size: 10px;
  flex: none;
}
@media (max-width: 860px) {
  .agent-workspace {
    grid-template-columns: minmax(0, 1fr) 150px;
  }
}
/* On phones the file list moves under the terminal so the terminal keeps
   a usable column count. */
@media (max-width: 600px) {
  .agent-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 130px;
  }
  .agent-panel {
    padding: 14px;
  }
}
.agent-terminal .xterm {
  height: 100%;
  padding: 10px 12px;
}
.agent-terminal .xterm-viewport {
  background: transparent;
  scrollbar-width: thin;
  scrollbar-color: #3a3f4c transparent;
}
.agent-panel-form {
  display: grid;
  gap: 8px;
}
.agent-panel-form textarea {
  width: 100%;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}
.agent-panel-form textarea:focus {
  outline: 0;
  border-color: var(--accent);
}
.agent-panel-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.agent-panel-buttons small {
  margin-right: auto;
  font-size: 11px;
}
.thinking {
  margin: 2px 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.thinking > summary {
  cursor: pointer;
  color: var(--muted);
  opacity: 0.75;
  list-style: none;
  user-select: none;
}
.thinking > summary::before {
  content: "▸ ";
}
.thinking[open] > summary::before {
  content: "▾ ";
}
.thinking > summary:hover {
  opacity: 1;
}
.thinking-body {
  max-height: 130px;
  overflow-y: auto;
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 2px solid var(--line);
  background: var(--panel-2);
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
  font-style: italic;
  opacity: 0.72;
  line-height: 1.5;
}
.media-history {
  margin-top: 22px;
}
.media-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.media-history-list {
  display: grid;
  gap: 8px;
}
.media-history-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.media-history-meta {
  min-width: 0;
  flex: 1;
}
.media-history-meta strong {
  display: block;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-history-meta small {
  color: var(--muted);
  font-size: 11px;
}
.media-history-preview {
  margin-top: 8px;
}
.media-history-preview audio,
.media-history-preview video,
.media-history-preview img {
  max-width: 100%;
  border-radius: 8px;
}
.media-history-actions {
  display: flex;
  gap: 6px;
  flex: none;
}
.service-dots {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 2px 0 18px;
}
.service-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.service-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
}
.service-dot.on i {
  background: var(--ok);
}
/* Dialog + settings shared ---------------------------------------------- */

.secondary-button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.3;
}
.secondary-button:hover {
  border-color: var(--accent);
}
.secondary-button.small,
.primary-button.small {
  padding: 6px 11px;
  font-size: 12px;
}
.secondary-button.accent {
  border-color: var(--accent);
  color: var(--accent);
}
.secondary-button.danger {
  border-color: var(--danger-soft);
  color: var(--danger);
}
.secondary-button.full {
  width: 100%;
}
.muted {
  color: var(--muted);
}
.hidden {
  display: none !important;
}
.badge {
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 7px;
  border-radius: 10px;
}
.badge.ok {
  color: var(--ok);
  background: var(--ok-soft);
}
.badge.off {
  color: var(--muted);
  background: var(--panel-2);
}
.badge.small {
  padding: 2px 6px;
}
.login-wall {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
}
/* Covers the gap between first paint and boot() deciding whether to reveal
   the app shell or the login wall, so a signed-out visitor never sees even a
   flash of the real interface before it. See boot() in app.js. */
.boot-loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.boot-loading .mark {
  animation: boot-loading-pulse 1.1s ease-in-out infinite;
}
@keyframes boot-loading-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
.login-wall-card {
  width: min(380px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 24px;
  box-shadow: var(--shadow);
}
.login-wall-card h2 {
  margin: 14px 0 4px;
}
.login-wall-card .brand {
  margin-bottom: 4px;
}
.form-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.admin-create-form {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: end;
  margin-top: 14px;
  max-width: 900px;
}
.admin-create-form button {
  height: 38px;
}
.admin-users-wrap {
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-users-table th,
.admin-users-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-users-table tr:last-child td {
  border-bottom: none;
}
.admin-users-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--panel-2);
}
.admin-users-table .actions {
  display: flex;
  gap: 6px;
}
.admin-users-table .actions button {
  font-size: 11px;
  padding: 4px 8px;
}
.admin-users-table td.you {
  color: var(--accent);
}
dialog {
  width: min(640px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #05050788;
}
.dialog-head {
  display: flex;
  gap: 10px;
}
.dialog-head > div {
  flex: 1;
}
.dialog-head h2 {
  margin: 2px 0;
  font-size: 18px;
  font-weight: 600;
}
.dialog-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.settings-form {
  gap: 16px;
  margin-top: 20px;
}
.settings-form:not([hidden]) {
  display: grid;
}
.settings-form .settings-form {
  margin-top: 0;
}
.settings-form label {
  font-size: 13px;
  display: block;
}
.settings-form label span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin: 3px 0 7px;
}
.settings-form input,
.settings-form textarea,
.settings-form select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px;
  border-radius: 9px;
  outline: 0;
}
.settings-form input:focus,
.settings-form textarea:focus,
.settings-form select:focus {
  border-color: var(--accent);
}
.agent-picker {
  display: grid;
  gap: 8px;
}
.agent-option {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.agent-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.agent-option.unavailable {
  opacity: 0.55;
  cursor: not-allowed;
}
.agent-option input {
  width: auto;
  accent-color: var(--accent);
}
.agent-option strong {
  display: block;
  font-size: 13px;
}
.agent-option small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}
.agent-run-files {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  background: var(--bg);
}
.agent-launch {
  margin-top: 10px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 11px;
  border-radius: 10px;
}
.settings-preview strong {
  display: block;
  font-size: 14px;
}
.settings-preview small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.status-orb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.dialog-actions > .muted {
  margin-right: auto;
  font-size: 12px;
}
.spacer {
  flex: 1;
}
.pull-form {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}
.pull-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 10px;
}
.progress {
  height: 30px;
  position: relative;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}
.progress div {
  height: 100%;
  width: 0;
  background: var(--accent-soft);
}
.progress span {
  position: absolute;
  inset: 6px 10px;
  font-size: 12px;
}
.model-action-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.model-action-status i {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: model-spin 0.8s linear infinite;
}
.model-action-status strong,
.model-action-status small {
  display: block;
}
.model-action-status small {
  color: var(--muted);
}
.model-action-status.success i {
  border: 0;
  animation: none;
  background: var(--ok);
}
.model-action-status.error i {
  border: 0;
  animation: none;
  background: var(--danger);
}
@keyframes model-spin {
  to {
    transform: rotate(360deg);
  }
}
.models-list {
  margin-top: 4px;
}
.model-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 13px 2px;
  gap: 10px;
}
.model-row > div {
  flex: 1;
}
.model-row small {
  display: block;
  color: var(--muted);
}
.model-row button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.model-row button:hover {
  border-color: var(--accent);
}
.model-row button:disabled {
  opacity: 0.45;
  cursor: wait;
}
.file-preview-dialog {
  width: min(1100px, calc(100% - 32px));
  height: min(820px, calc(100% - 32px));
}
.file-preview-dialog iframe {
  width: 100%;
  height: calc(100% - 124px);
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.file-preview-dialog img {
  max-width: 100%;
  max-height: calc(100% - 124px);
  margin-top: 14px;
  border-radius: 10px;
}
.file-editor {
  display: block;
  width: 100%;
  height: calc(100% - 124px);
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  resize: none;
  tab-size: 2;
}
.file-editor:focus {
  outline: 0;
  border-color: var(--accent);
}
.file-preview-dialog .dialog-actions {
  margin-top: 12px;
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 15px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateY(6px);
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.drag-overlay {
  position: fixed;
  inset: 0;
  background: var(--accent-soft);
  backdrop-filter: blur(2px);
  z-index: 40;
  border: 2px dashed var(--accent);
  margin: 10px;
  border-radius: 16px;
}
.drag-overlay:not([hidden]) {
  display: grid;
  place-items: center;
}
.drag-overlay div {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 600;
}
/* Shown only while the mobile sidebar or telemetry drawer is open (see the
   #menu/#telemetry-toggle handlers) - tapping it closes whichever is open.
   Without this, the sidebar overlaps and covers #menu itself while open,
   leaving no way to close it again on a touch device. */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: #05050788;
}

/* Code workspace --------------------------------------------------------- */

.workspace-files {
  border-top: 1px solid var(--line);
  margin-top: auto;
  padding-top: 12px;
}
.workspace-files-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.workspace-files-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.workspace-files-head button:hover {
  background: var(--panel-2);
  color: var(--text);
}
.file-actions {
  display: flex;
  gap: 4px;
}
.workspace-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 5px 2px;
}
.workspace-file > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.workspace-file small {
  color: var(--muted);
  margin-left: 6px;
}
.workspace-file button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 6px;
  cursor: pointer;
  font-size: 12px;
}
.workspace-file button:hover {
  color: var(--accent);
  border-color: var(--accent);
}
/* Skills / agents --------------------------------------------------------- */

.skills-view,
.agents-view {
  padding: 28px max(20px, calc((100% - 1080px) / 2));
  overflow: auto;
}
.skills-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.skills-toolbar > button {
  flex: none;
  white-space: nowrap;
}
.skills-toolbar h2 {
  margin: 3px 0 0;
  font-size: 21px;
  font-weight: 600;
}
.skills-toolbar p {
  color: var(--muted);
  font-size: 13px;
  margin: 5px 0 0;
}
.skills-toolbar code {
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.skills-category h3 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin: 22px 0 10px;
}
.skills-category:first-child h3 {
  margin-top: 0;
}
.skills-grid,
.agents-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.skill-card,
.agent-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
}
.skill-card .skill-actions,
.agent-card .skill-actions {
  margin-top: auto;
}
.skill-card p,
.agent-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 12px;
}
.agent-card p + p.small {
  margin-top: -4px;
}
.skill-head,
.agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.agent-head {
  align-items: flex-start;
}
.agent-head .badge {
  margin-top: 2px;
}
.skill-icon,
.agent-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  flex: none;
}
.agent-head > div {
  flex: 1;
}
.agent-head small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.skill-actions {
  display: flex;
  gap: 8px;
}
.agent-card.unavailable {
  opacity: 0.6;
}
.small {
  font-size: 12px;
}

/* Responsive --------------------------------------------------------------- */

@media (max-width: 1180px) {
  body {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .telemetry {
    position: fixed;
    inset: 0 0 0 auto;
    width: 300px;
    z-index: 6;
    transform: translateX(100%);
    transition: transform 0.2s;
    box-shadow: var(--shadow);
  }
  .telemetry.open {
    transform: none;
  }
  .telemetry-toggle {
    display: grid;
  }
  #telemetry-close {
    display: grid;
  }
}
@media (max-width: 720px) {
  body {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 7;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: var(--shadow);
  }
  .sidebar.open {
    transform: none;
  }
  #menu {
    display: grid;
  }
  header {
    padding: 0 10px;
    gap: 8px;
  }
  .header-title small {
    display: none;
  }
  .header-actions {
    gap: 2px;
  }
  .header-actions .icon-button {
    width: 30px;
  }
  #export-button {
    display: none;
  }
  .model-select {
    max-width: 104px;
    padding: 6px 4px 6px 8px;
    margin-right: 2px;
  }
  .chat {
    padding-left: 14px;
    padding-right: 14px;
  }
  .composer {
    padding-left: 14px;
    padding-right: 14px;
  }
  .attachment-tray {
    padding-left: 14px;
    padding-right: 14px;
  }
  .privacy-note {
    display: none;
  }
  .tool-toggle {
    padding: 5px 9px;
    font-size: 11px;
  }
  .starter-grid {
    grid-template-columns: 1fr;
  }
  .message.user .message-body {
    max-width: 88%;
  }
  .skills-view,
  .agents-view {
    padding: 20px 14px;
  }
  .skills-toolbar {
    align-items: start;
    flex-direction: column;
  }
}
