:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --glow: #966cff0c;
  --panel: #101216;
  --raised: #14161c;
  --ink: #d7dae1;
  --muted: #8b919d;
  --faint: #626775;
  --line: #23262e;
  --strong-line: #30343e;
  --accent: #b892ff;
  --accent-strong: #a06bff;
  --on-accent: #16101f;
  --pale: #a06bff24;
  --select: #a06bff52;
  --error: #f07a7a;
  --warn: #f0b45a;
  --ok: #63d69a;
  --user: #7fd1ff;
  --assistant: #c3a6ff;
  --veil: #000000cc;
  --lift: 0 14px 40px #00000073;
  --header-shadow: 0 1px 4px #00000066;
  /* Transcript surfaces sit back; the composer is the one raised thing, so
   * a tool box or a message bubble never reads as a place to type. */
  --recess: #0f1115;
  --composer: #171920;
  --composer-shadow: 0 10px 30px #00000073, inset 0 1px 0 #ffffff0a;

  --ui: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --bar-height: 36px;

  --rail: 248px;
  font: 13px/1.55 var(--ui);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
:root[data-theme=light] {
  color-scheme: light;
  --bg: #f6f5f2;
  --glow: #7e4ff014;
  --panel: #ffffff;
  --raised: #f0eeea;
  --ink: #26242b;
  --muted: #5f5b66;
  --faint: #918c98;
  --line: #dcd8d0;
  --strong-line: #c9c4ba;
  --accent: #6a37e6;
  --accent-strong: #7b4ff0;
  --on-accent: #ffffff;
  --pale: #7b4ff01f;
  --select: #7b4ff038;
  --error: #d0463f;
  --warn: #c07a12;
  --ok: #1f9d57;
  --user: #1f77c9;
  --assistant: #6a37e6;
  --veil: #26242b66;
  --lift: 0 14px 40px #26242b2e;
  --header-shadow: 0 1px 4px #26242b1c;
  --recess: #efede8;
  --composer: #ffffff;
  --composer-shadow: 0 8px 26px #26242b1a, 0 1px 3px #26242b17;
}

/*
 * Color themes. Each has a light and a dark version, chosen by the same
 * switch as OpenPod's own, so the two settings never meet a missing pair.
 * A theme sets its surfaces, text and signal colors; the in-between tones
 * are mixed from those so every theme gets the same contrast steps.
 */
[data-palette] {
  --raised: color-mix(in srgb, var(--ink) 6%, var(--panel));
  --recess: color-mix(in srgb, var(--bg) 50%, var(--panel));
  --composer: color-mix(in srgb, var(--ink) 4%, var(--panel));
  --muted: color-mix(in srgb, var(--ink) 66%, var(--bg));
  --faint: color-mix(in srgb, var(--ink) 44%, var(--bg));
  --line: color-mix(in srgb, var(--ink) 13%, var(--bg));
  --strong-line: color-mix(in srgb, var(--ink) 21%, var(--bg));
  --accent-strong: var(--accent);
  --on-accent: var(--bg);
  --pale: color-mix(in srgb, var(--accent) 15%, transparent);
  --select: color-mix(in srgb, var(--accent) 32%, transparent);
  --glow: color-mix(in srgb, var(--accent) 5%, transparent);
}
[data-palette][data-theme=light] {
  --raised: color-mix(in srgb, var(--ink) 5%, var(--bg));
  --composer: var(--panel);
  --on-accent: #ffffff;
}
[data-palette=vscode] { --bg: #1f1f1f; --panel: #181818; --ink: #cccccc; --accent: #3794ff; --error: #f14c4c; --warn: #cca700; --ok: #89d185; --user: #4fc1ff; --assistant: #c586c0; }
[data-palette=vscode][data-theme=light] { --bg: #f8f8f8; --panel: #ffffff; --ink: #3b3b3b; --accent: #005fb8; --error: #e51400; --warn: #bf8803; --ok: #388a34; --user: #0070c1; --assistant: #af00db; }
[data-palette=solarized] { --bg: #002b36; --panel: #073642; --ink: #93a1a1; --accent: #268bd2; --error: #dc322f; --warn: #b58900; --ok: #859900; --user: #2aa198; --assistant: #6c71c4; }
[data-palette=solarized][data-theme=light] { --bg: #eee8d5; --panel: #fdf6e3; --ink: #586e75; --accent: #268bd2; --error: #dc322f; --warn: #b58900; --ok: #859900; --user: #2aa198; --assistant: #6c71c4; }
[data-palette=github] { --bg: #0d1117; --panel: #161b22; --ink: #e6edf3; --accent: #4493f8; --error: #f85149; --warn: #d29922; --ok: #3fb950; --user: #79c0ff; --assistant: #d2a8ff; }
[data-palette=github][data-theme=light] { --bg: #f6f8fa; --panel: #ffffff; --ink: #1f2328; --accent: #0969da; --error: #cf222e; --warn: #9a6700; --ok: #1a7f37; --user: #0550ae; --assistant: #8250df; }
[data-palette=one] { --bg: #21252b; --panel: #282c34; --ink: #abb2bf; --accent: #61afef; --error: #e06c75; --warn: #e5c07b; --ok: #98c379; --user: #56b6c2; --assistant: #c678dd; }
[data-palette=one][data-theme=light] { --bg: #eaeaeb; --panel: #fafafa; --ink: #383a42; --accent: #4078f2; --error: #e45649; --warn: #c18401; --ok: #50a14f; --user: #0184bc; --assistant: #a626a4; }
[data-palette=gruvbox] { --bg: #1d2021; --panel: #282828; --ink: #ebdbb2; --accent: #fe8019; --error: #fb4934; --warn: #fabd2f; --ok: #b8bb26; --user: #83a598; --assistant: #d3869b; }
[data-palette=gruvbox][data-theme=light] { --bg: #f2e5bc; --panel: #fbf1c7; --ink: #3c3836; --accent: #af3a03; --error: #9d0006; --warn: #b57614; --ok: #79740e; --user: #076678; --assistant: #8f3f71; }
[data-palette=catppuccin] { --bg: #181825; --panel: #1e1e2e; --ink: #cdd6f4; --accent: #cba6f7; --error: #f38ba8; --warn: #f9e2af; --ok: #a6e3a1; --user: #89b4fa; --assistant: #f5c2e7; }
[data-palette=catppuccin][data-theme=light] { --bg: #e6e9ef; --panel: #eff1f5; --ink: #4c4f69; --accent: #8839ef; --error: #d20f39; --warn: #df8e1d; --ok: #40a02b; --user: #1e66f5; --assistant: #ea76cb; }
[data-palette=tokyo] { --bg: #16161e; --panel: #1a1b26; --ink: #c0caf5; --accent: #7aa2f7; --error: #f7768e; --warn: #e0af68; --ok: #9ece6a; --user: #7dcfff; --assistant: #bb9af7; }
[data-palette=tokyo][data-theme=light] { --bg: #e1e2e7; --panel: #eef0f4; --ink: #3760bf; --accent: #2e7de9; --error: #f52a65; --warn: #8c6c3e; --ok: #587539; --user: #007197; --assistant: #9854f1; }
[data-palette=rosepine] { --bg: #191724; --panel: #1f1d2e; --ink: #e0def4; --accent: #c4a7e7; --error: #eb6f92; --warn: #f6c177; --ok: #9ccfd8; --user: #ebbcba; --assistant: #c4a7e7; }
[data-palette=rosepine][data-theme=light] { --bg: #f2e9e1; --panel: #fffaf3; --ink: #575279; --accent: #907aa9; --error: #b4637a; --warn: #ea9d34; --ok: #56949f; --user: #d7827e; --assistant: #907aa9; }
[data-palette=everforest] { --bg: #232a2e; --panel: #2d353b; --ink: #d3c6aa; --accent: #83c092; --error: #e67e80; --warn: #dbbc7f; --ok: #a7c080; --user: #7fbbb3; --assistant: #d699b6; }
[data-palette=everforest][data-theme=light] { --bg: #efebd4; --panel: #fdf6e3; --ink: #5c6a72; --accent: #35a77c; --error: #f85552; --warn: #dfa000; --ok: #8da101; --user: #3a94c5; --assistant: #df69ba; }
[data-palette=ayu] { --bg: #0b0e14; --panel: #0f131a; --ink: #bfbdb6; --accent: #e6b450; --error: #d95757; --warn: #ffb454; --ok: #aad94c; --user: #59c2ff; --assistant: #d2a6ff; }
[data-palette=ayu][data-theme=light] { --bg: #f3f4f5; --panel: #fcfcfc; --ink: #5c6166; --accent: #d1771c; --error: #e65050; --warn: #c88a1c; --ok: #5b9a2e; --user: #399ee6; --assistant: #a37acc; }
[data-palette=nightowl] { --bg: #011627; --panel: #0b2942; --ink: #d6deeb; --accent: #82aaff; --error: #ef5350; --warn: #ffcb8b; --ok: #addb67; --user: #7fdbca; --assistant: #c792ea; }
[data-palette=nightowl][data-theme=light] { --bg: #f0f0f0; --panel: #fbfbfb; --ink: #403f53; --accent: #4876d6; --error: #de3d3b; --warn: #b38a00; --ok: #08916a; --user: #0c969b; --assistant: #994cc3; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 18% 0, var(--glow), transparent 45%), var(--bg);
  color: var(--ink);
}
[hidden] { display: none !important; }
::selection { background: var(--select); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid var(--strong-line);
  border-radius: 5px;
  background: var(--raised);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--pale); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.quiet:hover:not(:disabled) { border-color: var(--line); color: var(--ink); }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, textarea, select {
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--strong-line);
  border-radius: 5px;
  background: var(--bg);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 500; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.35; font-weight: 600; }
h2 { font-size: 15px; }
h3 { margin-top: 1.75em; font-size: 13px; }
.small { font-size: 11px; }
.muted { color: var(--muted); }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; z-index: 20; background: var(--panel); padding: 12px; }

.topbar {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  height: var(--bar-height); padding: 0 14px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand-cluster {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
}
.brand {
  display: flex; align-items: center; gap: 7px;
  border: 0; background: none; padding: 0 !important;
  color: var(--ink); text-decoration: none; font-size: 12px;
  font-weight: 600; letter-spacing: .01em; opacity: .85;
}
.brand:hover, .brand:focus-visible { opacity: 1; background: none; }
.brand img { width: 17px; height: 17px; }
.brand-name { white-space: nowrap; }
@media (max-width: 420px) { .brand-name { display: none; } }
@media (max-width: 650px) {
  /* The right-hand cluster grows on small screens, so the wordmark moves out
   * of the center to give it room. */
  .brand-cluster { position: static; transform: none; }
}
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar button { min-height: 24px; padding: 2px 8px; font-size: 11px; }
.account-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); }
.app-menu-button { width: 28px; padding: 0 !important; font-size: 11px !important; letter-spacing: 1px; }

.machine-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 190px; min-height: 24px; padding: 2px 10px;
  border-radius: 12px; font-size: 11px; white-space: nowrap;
}
.machine-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.machine-chip .dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.machine-chip.online .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.machine-chip.offline .dot { background: var(--warn); }
.devices-panel { min-width: 240px; max-width: 320px; }
.devices-list { display: flex; flex-direction: column; gap: 2px; }
.device-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 5px 6px; border-radius: 6px;
}
.device-row:hover { background: var(--hover, color-mix(in srgb, var(--ink) 6%, transparent)); }
.device-label { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; min-width: 0; }
.device-label strong { font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.device-label .dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.device-row.online .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.device-row.offline .dot { background: var(--warn); }
.device-row.offline strong { color: var(--muted); }
.device-meta { flex-basis: 100%; padding-left: 12px; color: var(--faint); font-size: 10px; }
.device-web { display: block; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--accent); font-size: 12px; }
.host-label { color: var(--accent); font-size: 9px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.device-open { flex: none; padding: 2px 8px; border-radius: 6px; font-size: 11px; text-decoration: none; }
#devices-note[hidden] { display: none; }
#devices-note { margin: 4px 0 0; padding: 0 6px; }
.menu-panel {
  position: absolute; top: calc(var(--bar-height) - 4px); right: 12px; z-index: 30;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  min-width: 150px; padding: 8px; border: 1px solid var(--strong-line);
  border-radius: 8px; background: var(--panel); box-shadow: var(--lift);
}
.menu-panel[hidden] { display: none; }
.menu-panel button { justify-content: flex-start; text-align: left; font-size: 12px; }
.menu-panel .account-name { max-width: none; padding: 2px 6px 5px; }
.menu-panel .account-name:empty { display: none; }
.app-menu-panel { min-width: 232px; max-height: calc(100dvh - var(--bar-height) - 16px); overflow-y: auto; }
.menu-setting-arrow { float: right; margin-left: 30px; color: var(--faint); }
.menu-separator { height: 1px; margin: 4px 6px; background: var(--line); }
.menu-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.menu-option-title { font-weight: 600; }
.menu-option-subtitle { color: var(--muted); font-size: 10px; line-height: 1.35; white-space: normal; }
.menu-switch {
  display: flex; grid-template-columns: none; flex-direction: row; align-items: center; justify-content: space-between;
  min-height: 28px; padding: 3px 6px; font-size: 12px; font-weight: 400; cursor: pointer;
}
.menu-switch input { position: absolute; opacity: 0; pointer-events: none; }
.menu-switch i { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--strong-line); transition: background .12s; }
.menu-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); transition: transform .12s; }
.menu-switch input:checked + i { background: var(--accent); }
.menu-switch input:checked + i::after { transform: translateX(12px); }
.menu-switch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 5px; }
.pane-menu { top: 38px; right: 8px; }
.menu-title { margin: 0 0 4px; padding: 2px 6px; color: var(--faint); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.shortcut-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 26px; padding: 3px 6px; border: 0; background: none;
  color: var(--ink); font-size: 12px; text-align: left;
}
.shortcut-row.static { cursor: default; }
.shortcut-row kbd {
  flex: none; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--raised); color: var(--muted); font: 10px var(--mono); white-space: nowrap;
}

.extensions-panel { min-width: 260px; max-width: 340px; max-height: 320px; overflow-y: auto; }
.extension-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 4px 6px; }
.extension-row + .extension-row { border-top: 1px solid var(--line); }
.extension-name { color: var(--ink); font-size: 12px; }
.extension-scope { color: var(--faint); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.extension-commands { flex-basis: 100%; color: var(--muted); font: 11px var(--mono); overflow-wrap: anywhere; }
.menu-empty { margin: 0; padding: 4px 6px; color: var(--muted); font-size: 12px; }

.remote-toggle { white-space: nowrap; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.remote-toggle[hidden] { display: none; }
.confirm-dialog { max-width: 390px; }
.confirm-dialog p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.shortcuts-dialog { max-width: 360px; }
.shortcuts-list { display: flex; flex-direction: column; gap: 4px; }
.account-dialog { max-width: 420px; }
.account-dialog form, #account-signup-fields { display: grid; gap: 12px; }
.account-mode-switch { padding: 0 0 8px; }
.sidebar-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }

/* The sign-in page at /login. It is the landing page's sibling, so it borrows
 * its wordmark and its calm: one card, nothing else asking for attention. */
body:has(#welcome:not([hidden])) .topbar { display: none; }
.welcome {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  min-height: 100dvh; padding: 0 24px 40px;
}
.welcome-nav { display: flex; justify-content: space-between; align-items: center; width: min(1040px, 100%); padding: 24px 0 0; margin-bottom: auto; }
.welcome-mark { display: inline-flex; align-items: baseline; gap: 5px; color: var(--ink); font: 650 23px/1 var(--mono); letter-spacing: -1.5px; text-decoration: none; }
.welcome-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.welcome-get { padding: 7px 13px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); font-size: 12px; text-decoration: none; }
.welcome-get:hover { border-color: var(--accent); color: var(--accent); }
.auth-card {
  width: min(380px, 100%); padding: 30px 30px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); box-shadow: var(--lift);
}
.auth-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.03em; }
.auth-card > .muted { margin: 0; font-size: 12px; }
.auth-card form { display: grid; gap: 16px; margin: 24px 0 8px; }
#auth-fields { display: grid; gap: 16px; min-width: 0; border: 0; padding: 0; margin: 0; }
.auth-card label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.auth-card input { min-height: 38px; border-radius: 8px; }
.auth-card .primary { min-height: 40px; margin-top: 4px; border-radius: 8px; font-weight: 600; }
.auth-card .link-button { display: block; margin: 0 auto; color: var(--accent); font-weight: 500; }
.welcome-foot { margin: 0 0 auto; max-width: 380px; color: var(--faint); font-size: 11px; text-align: center; }
.link-button { padding: 7px 0; margin-bottom: 18px; border: 0; background: none; color: var(--accent); font-size: 12px; }
.banner { margin: 0; padding: 10px 20px; background: color-mix(in srgb, var(--warn) 7%, transparent); font-size: 12px; }
.banner p { margin: 0 0 8px; }
.error { background: color-mix(in srgb, var(--error) 8%, transparent); color: var(--error); }
.error-text { color: var(--error); font-size: 12px; overflow-wrap: anywhere; }

.workspace {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  position: relative; height: calc(100dvh - var(--bar-height)); min-height: 360px;
  overflow: hidden;
}
.sidebar {
  grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 10px 12px;
  overflow: auto; background: var(--panel);
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-heading h2 { margin: 0; font-size: 12px; font-weight: 500; }
'.section-heading button { font-size: 11px; }
.sidebar-new { border: 1px solid var(--strong-line); border-radius: 6px; padding: 3px 10px; background: var(--panel); color: var(--ink); }
.sidebar-new:hover:not(:disabled) { border-color: var(--accent); }
/* A pencil to rename a computer, sized to the row it lives in. */
.device-edit { flex: none; padding: 2px 6px; font-size: 12px; }
.rename-field { display: grid; gap: 4px; margin: 12px 0; font-size: 12px; color: var(--muted); }
.rename-field input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font-size: 13px; }
.sidebar > .section-heading { padding-left: 8px; }
.sidebar > #machine-status { margin: 0 8px; }
.machine-list, .session-list { display: grid; gap: 2px; padding: 0 6px 0 4px; }
.machine-button, .session-button {
  display: grid; gap: 2px; width: 100%; min-width: 0; padding: 6px 8px;
  text-align: left; background: transparent; border-color: transparent;
}
.machine-button[aria-pressed=true], .session-button[aria-current=true] { background: var(--pale); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.machine-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.machine-name strong, .session-button strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.badge { padding: 2px 7px; border-radius: 4px; background: var(--pale); color: var(--accent); font-size: 11px; font-weight: 500; white-space: nowrap; }

.run-stats { color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.run-stats.live { color: var(--accent); }

.context-meter { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 0; }
/* The graph compresses before the row does: a bar squeezed to a sliver still
 * says "how much", while a control pushed to the next line says nothing. */
.context-bar { width: 54px; height: 4px; border-radius: 2px; background: var(--strong-line); overflow: hidden; flex: 0 1 auto; min-width: 14px; }
#context-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.context-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.context-meter.high { color: var(--warn); }
.context-meter.high .context-bar i { background: var(--warn); }
.context-meter.full { color: var(--error); }
.context-meter.full .context-bar i { background: var(--error); }
.online { color: var(--ok); }
.offline { color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.online .dot { background: var(--ok); }
.machine-meta, .session-meta { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.session-meta { display: flex; gap: 6px; align-items: baseline; }
.session-when { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.session-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 10px; }
.sessions-heading { margin-top: 0; }
.search-label input { width: 100%; padding: 6px 9px; font-size: 12px; }
.history-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.history-controls label { min-width: 0; gap: 3px; color: var(--muted); font-size: 10px; }
.history-controls select { width: 100%; min-width: 0; font-size: 11px; padding: 5px 3px; color: var(--ink); }
.session-status { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; flex: none; color: var(--muted); }
.session-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.session-status.running { color: var(--ok); }
.session-status.running::before { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 15%, transparent); }
.session-status.inactive::before { border-radius: 1px; opacity: .6; }
.session-status.offline::before { background: none; border: 1px solid currentColor; }
.workspace { --rail: 0px; }
.sidebar {
  position: absolute; inset: 0 auto 0 0; z-index: 5; width: min(272px, 85vw);
  transform: translateX(-100%); transition: transform .16s ease-out;
  box-shadow: var(--lift); border-right: 1px solid var(--line);
}
.workspace.sidebar-open .sidebar { transform: translateX(0); }
.sidebar-scrim { display: none; position: absolute; inset: 0; z-index: 4; border: 0; border-radius: 0; background: #0003; }
.workspace.sidebar-open .sidebar-scrim { display: block; }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.conversation { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; position: relative; min-width: 0; min-height: 0; background: var(--bg); }
.daemon-version {
  font-size: 10px; line-height: 1; color: var(--muted); opacity: .72;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.panes { grid-column: 2; grid-row: 1; position: relative; min-width: 0; min-height: 0; background: var(--bg); }
.shell-history {
  display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--muted);
}
/* The Mac window's traffic-light buttons float over the web view's top-left,
 * so in the native shell the button starts clear of them. */
html[data-app-shell="mac"] .shell-history { margin-left: 62px; }
.shell-history:hover, .shell-history[aria-expanded="true"] { color: var(--accent); }
.sidebar-edge { position: absolute; inset: 0 auto 0 0; z-index: 3; width: 10px; }
.device-catalog-frame { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; }
.pane { position: absolute; overflow: hidden; background: var(--bg); }
/* The divider is a real border, drawn above the pane's iframe so the pane's
 * own content cannot cover it. No box-shadow: the line is the separator, and
 * the container behind the panes is plain `--bg` so a fractional gap between
 * percentage-positioned panes cannot anti-alias into a soft shadow. */
.pane::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border: 1px solid var(--line); }
.pane.focused { z-index: 1; }
.pane.focused::after { border: 2px solid var(--accent); }
/* A phone never shows two panes on screen, so "which one is active" is already
 * answered by the tab strip above it; an accent border around a pane that
 * fills the viewport would only draw on top of the content's own edge. */
.panes.compact .pane.focused::after { border: 1px solid var(--line); }
/* The focus zoom exists to let one pane take the screen from its siblings.
 * Compact already gives every pane the whole screen, so the button goes. */
.panes.compact .pane-focus { display: none; }
.panes.single .pane::after { display: none; }
.pane iframe { width: 100%; height: 100%; border: 0; display: block; }
.pane-tabs { position: absolute; top: 0; left: 0; right: 0; height: 44px; z-index: 2; display: flex; gap: 4px; overflow-x: auto; padding: 4px; }
.pane-tabs button { flex: 1 0 100px; min-width: 0; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.pane-tabs button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.pane-actions { position: absolute; top: 0; right: 4px; height: 40px; display: flex; align-items: center; gap: 2px; z-index: 2; }
.pane-actions button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; min-height: 26px; padding: 0; }
/* A phone shows one pane at a time, where "split" means nothing and "New
 * tab" is the pane the user is actually trying to make. */
.pane-actions .pane-newtab { display: none; width: auto; padding: 0 9px; font-size: 11px; white-space: nowrap; }
.panes.compact .pane-split { display: none; }
.panes.compact .pane-newtab { display: inline-flex; }
.pane-close { font-size: 15px; line-height: 1; }
.pane-actions svg { display: block; }
.panes.single .pane-close { display: none; }
.panes.single:not(.compact) .pane.no-session .pane-actions { display: none; }
.pane-divider { position: absolute; z-index: 3; background: transparent; }
.pane-divider.row { width: 7px; margin-left: -3px; cursor: col-resize; }
.pane-divider.col { height: 7px; margin-top: -3px; cursor: row-resize; }
.pane-divider:hover, .pane-divider.dragging { background: var(--accent); opacity: .5; }

/* Modal zoom without moving/reloading the iframe or touching the split tree.
 * The backdrop blurs the live workspace; inert siblings cannot take focus. */
.focus-backdrop { position: fixed; inset: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 48%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pane.spotlight {
  --focus-x: max(18px, 4vw, calc((100vw - 1440px) / 2)); --focus-y: clamp(18px, 5vh, 48px);
  position: fixed; z-index: 101; border-radius: 10px; box-shadow: var(--lift);
  left: var(--focus-x) !important; top: var(--focus-y) !important;
  width: calc(100vw - 2 * var(--focus-x)) !important; height: calc(100dvh - 2 * var(--focus-y)) !important;
}
.panes .pane.spotlight::after { display: block; border-radius: inherit; }
.panes .pane.spotlight .pane-actions { display: flex; }
.pane-focus[aria-pressed="true"] { color: var(--accent); background: var(--pale); }

body.shell-view > main > .workspace > .conversation { display: none; }

body.pane-view .topbar, body.pane-view .sidebar,
body.pane-view #panes, body.pane-view #welcome { display: none; }
body.catalog-view { display: none; }
body.pane-view { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.pane-view > main { flex: 1; min-height: 0; }
body.pane-view .workspace { height: 100%; min-height: 0; }
body.pane-view .session-browser .search-label { margin-top: 0; width: min(420px, 100%); }
body.pane-view .session-browser .session-list { width: min(420px, 100%); max-height: 40vh; overflow-y: auto; }
.session-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 16px; position: relative; z-index: 1; box-shadow: var(--header-shadow); }
.session-side { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: nowrap; }
.session-side.end { justify-content: flex-end; }
/* The overflow menu hangs under the header's right end, where the row it
 * replaces used to sit. */
.session-menu { top: calc(100% + 2px); right: 16px; }
body.pane-view .session-side.end { margin-right: 122px; }
body.pane-view.solo-pane .session-side.end { margin-right: 90px; }
.device-session-group + .device-session-group { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.device-session-heading { display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0; margin: 0 0 5px; padding: 4px; color: var(--muted); font-size: 11px; text-align: left; }
.device-session-heading strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
/* The collapse mark is a flat chevron, not a glyph with its own ideas about
 * size: same stroke as every other caret in the app, rotated when closed. */
.group-chevron { width: 9px; height: 6px; flex: none; color: var(--faint); transition: transform .12s ease; }
[aria-expanded="false"] .group-chevron { transform: rotate(-90deg); }
.group-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.device-session-contents > p { padding: 4px 8px; }
.message-footer { display: flex; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: 10px; line-height: 1.5; margin: -18px 0 26px; }
.message-footer[data-role="user"] { justify-content: flex-end; }
.message-footer > span { overflow-wrap: anywhere; min-width: 0; }
.message-footer > span + span::before { content: "\00b7"; margin-right: 5px; }
.tool + .message-footer, .thought + .message-footer { margin-top: 0; }
/* Read-aloud controls: quiet until the reply is hovered or one is in use. */
.message-actions { display: inline-flex; align-items: center; gap: 1px; margin: -3px 0 -3px 2px; }
.message-actions[hidden] { display: none; }
.message-action { display: inline-grid; place-items: center; width: 22px; height: 22px; min-height: 0; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); opacity: .55; cursor: pointer; transition: opacity .15s, color .15s, background .15s; }
.message-footer:hover .message-action, .message-action:focus-visible { opacity: 1; }
.message-actions .message-action:hover:not(:disabled) { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); opacity: 1; }
.message-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.message-action.active { color: var(--accent); opacity: 1; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.message-action.busy svg { animation: narrate-pulse 1.1s ease-in-out infinite; }
@keyframes narrate-pulse { 50% { opacity: .35; } }
@media (hover: none) { .message-action { opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .message-action.busy svg { animation: none; } }
.message-image { max-width: min(100%, 420px); max-height: 340px; object-fit: contain; border-radius: 8px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0; max-height: 180px; overflow-y: auto; }
.attachment-chip { display: flex; align-items: center; gap: 8px; width: min(100%, 310px); min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.attachment-preview { width: 38px; height: 38px; flex: none; object-fit: cover; border-radius: 4px; }
.attachment-kind { padding: 4px; color: var(--accent); font-size: 10px; border: 1px solid var(--line); border-radius: 4px; }
.attachment-body { display: grid; min-width: 0; gap: 2px; }
.attachment-name, .attachment-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-name { font-size: 11px; }
.attachment-meta, .attachment-status { color: var(--muted); font-size: 10px; }
.attachment-remove { margin-left: auto; min-height: 26px; padding: 3px 5px; font-size: 10px; background: transparent; }
.attachment-status { flex-basis: 100%; }
.attachment-status.error { color: var(--error); }
#attach-file { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.session-heading { min-width: 0; display: flex; justify-content: flex-start; align-items: baseline; gap: 10px; position: relative; }
.session-heading h1 { flex: 0 1 auto; min-width: 0; margin: 0; font-size: 13px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/*
 * The metadata popover. The title bar shows only the title now; which computer
 * the session is on and the folder it is working in live here, under the title,
 * brought up by hovering the title (or focusing it from the keyboard). It is a
 * small card, not a menu: read it and it goes away, and it never reaches far
 * enough to fight the header's right-hand controls.
 */
.session-info {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40;
  max-width: min(360px, calc(100vw - 32px)); padding: 7px 10px;
  border: 1px solid var(--strong-line); border-radius: 8px; background: var(--panel);
  box-shadow: var(--lift); color: var(--muted); font-size: 11px; line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto;
  display: none;
}
.session-info.open { display: block; }
.session-info[hidden] { display: none; }
.session-header button { font-size: 11px; flex-shrink: 0; height: 26px; min-height: 26px; padding: 3px 9px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; white-space: nowrap; }

.icon-button { width: 26px; height: 26px; min-height: 26px; padding: 0 !important; font-size: 14px; line-height: 1; }
.star { color: var(--muted); }
.star[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }

#session-title.editable { cursor: text; }
#session-title.editable:hover { text-decoration: underline dotted var(--strong-line); text-underline-offset: 3px; }
.rename-mark { margin-left: -6px; width: 22px; padding: 0 !important; border-color: transparent; background: none; color: var(--muted); font-size: 12px; }
.rename-mark:hover { color: var(--accent); }
/* Swap the session in this tile: a caret beside the pencil, and the same filterable list the zero state uses for computers. */
.switch-session { margin-left: -8px; width: 20px; min-height: 20px; padding: 0 !important; border-color: transparent; background: none; color: var(--muted); }
.switch-session:hover, .switch-session[aria-expanded="true"] { color: var(--accent); }
.session-picker .machine-picker-menu { width: min(340px, calc(100vw - 24px)); }
.machine-picker-option .dot.idle { background: var(--line); }

#session-title-input { flex: 1; min-width: 0; min-height: 26px; padding: 3px 8px; font-size: 13px; font-weight: 600; }
.session-header.empty .session-heading,
.session-header.empty .session-side.end > :not(#extensions-button):not(#retry-connection) { visibility: hidden; }
.workspace:not(.focused) .session-toolbar { display: none; }
.session-toolbar { display: none; }
.session-toolbar > span:first-child { margin-right: auto; color: var(--muted); }
.session-toolbar label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 400; }
.session-toolbar select { max-width: 220px; padding: 4px 7px; font-size: 11px; }
.transcript {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  overflow-anchor: none;
  padding: 28px max(20px, calc((100% - 780px) / 2)) 24px;
}

.sidebar, .transcript, .tool pre, dialog, .session-list, .command-list { scrollbar-width: thin; scrollbar-color: var(--strong-line) transparent; }
.empty-conversation { position: relative; max-width: 460px; margin: clamp(16px, 6vh, 64px) auto; text-align: center; color: var(--muted); }
.empty-conversation h2 { color: var(--ink); font-size: 15px; }
.empty-conversation p { margin: 0 0 .7em; }
.empty-conversation strong { color: var(--ink); font-weight: 600; }

.empty-brand {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin: 0 0 14px !important; color: var(--ink); font-size: 19px; font-weight: 600; letter-spacing: -.01em;
}
.empty-brand .empty-mark { display: block; margin: 0; width: 26px; height: 26px; }
.compact-empty-title { display: none; }
.empty-welcome a { color: var(--ink); font-weight: 600; }

.empty-welcome, .empty-more { display: none; }
body:not(.solo-pane) .empty-brand { font-size: 16px; }
body.solo-pane .empty-welcome, body.solo-pane .empty-more { display: block; }
.empty-tip { line-height: 1.45; }
.empty-split-buttons { display: grid; width: max-content; max-width: 100%; gap: 6px; margin: 8px auto 12px; }
.empty-split {
  display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 4px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--raised); color: var(--ink); font-size: 12px;
}
.empty-split:hover { border-color: var(--accent); color: var(--accent); }
.empty-split svg { width: 15px; height: 15px; flex: none; }
/* On a phone the window is one tab at a time, so there is nothing to split. */
@media (max-width: 699px) { body.solo-pane .empty-tip { display: none; } }
/* A lone pane with nothing open has no header worth a row: the bar would only
 * hold the split buttons, and the zero state now offers those itself. */
@media (min-width: 700px) {
  body.pane-view.solo-pane .session-header.empty:not(:has(#retry-connection:not([hidden]))) { display: none; }
}

/* Every zero state gets the title sequence; split tiles keep it compact. */
.empty-intro {
  --rain-l: 67%;
  display: block; width: max-content; max-width: 100%; margin: 0 auto 18px; overflow: hidden;
  font: 400 min(11px, calc((100vw - 56px) / 38))/1 var(--mono); white-space: pre; text-align: left; user-select: none;
}
body:not(.solo-pane) .empty-intro { font-size: min(8px, calc((100vw - 56px) / 38)); margin-bottom: 10px; }
:root[data-theme=light] .empty-intro { --rain-l: 50%; }
.empty-brand .empty-mark { display: none; }
.intro-row { height: 1em; }
.empty-intro .g { display: inline-block; color: hsl(calc(var(--x) * 6.5deg + 250deg) 88% var(--rain-l)); }
/* Font block glyphs leave hairline seams at fractional sizes; paint the cell solid. */
.empty-intro .g.b { background: currentColor; box-shadow: 0 0 0 .5px currentColor; }
.fx-decode .g.b:not(.on) { background: none; box-shadow: none; }
.empty-intro.settled .g {
  color: color-mix(in oklab, var(--accent) calc(100% - var(--x) * 1.8%), var(--user));
  transition: color .9s ease;
}
.fx-cascade { animation: intro-hue 2.2s linear; }
.fx-cascade .g { animation: intro-drop .55s cubic-bezier(.2, .9, .3, 1.25) var(--d) both; }
.fx-terminal .intro-row:not(.on) { visibility: hidden; }
.fx-terminal .intro-row.on { animation: intro-print .16s steps(2) both; }
.fx-terminal .g { color: hsl(calc(var(--y) * 38deg + 200deg) 85% var(--rain-l)); }
.fx-decode .g { color: var(--faint); opacity: .6; }
.fx-decode .g.on { color: hsl(calc(var(--x) * 6.5deg + 250deg) 88% var(--rain-l)); opacity: 1; animation: intro-flash .4s ease-out; }
.empty-brand .fx-hidden { opacity: 0; }
.empty-brand .fx-rainbow {
  background: linear-gradient(90deg, #ff6b6b, #ffc94d, #63d69a, #7fd1ff, #b892ff, #ff7ad9, #ff6b6b) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: intro-sweep .9s ease-out both;
}
.empty-brand .fx-mono { font: 500 15px var(--mono); color: var(--ok); }
.intro-cursor {
  display: inline-block; width: .55em; height: 1.05em; margin-left: 2px; vertical-align: -.16em;
  background: var(--accent); animation: intro-blink .9s steps(1) infinite;
}
.empty-conversation.intro-playing > :not(.empty-intro):not(.empty-brand) { visibility: hidden; }
.empty-conversation.intro-reveal > :not(.empty-intro):not(.empty-brand) { animation: intro-reveal .5s ease-out both; }
.empty-conversation.intro-reveal > :nth-child(n+5) { animation-delay: .08s; }
.empty-conversation.intro-reveal > :nth-child(n+6) { animation-delay: .16s; }
.empty-conversation.intro-reveal > :nth-child(n+7) { animation-delay: .24s; }
@keyframes intro-hue { to { filter: hue-rotate(360deg); } }
@keyframes intro-drop { from { opacity: 0; transform: translateY(-1.6em) scale(1.5); } }
@keyframes intro-print { from { opacity: 0; } }
@keyframes intro-flash { from { transform: scale(1.35); text-shadow: 0 0 8px currentColor; } }
@keyframes intro-sweep { from { opacity: 0; background-position: 100% 0; letter-spacing: .25em; } }
@keyframes intro-blink { 50% { opacity: 0; } }
@keyframes intro-reveal { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .empty-intro *, .empty-intro, .empty-brand *, .empty-conversation > * { animation: none !important; transition: none !important; }
}
.empty-machine { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 8px; line-height: 1.45; }
.empty-more kbd {
  padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--raised); color: var(--ink); font: inherit; font-size: 11px; white-space: nowrap;
}
.empty-mark { display: block; margin: 0 auto 18px; width: 40px; height: 40px; }


.machine-picker { position: absolute; z-index: 20; display: none; text-align: left; }
.machine-picker:not([hidden]) { display: block; }
.machine-picker-button {
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px; padding: 2px 10px 3px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--raised); color: var(--ink); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
}
.machine-picker-button:hover { border-color: var(--strong-line); }
.machine-picker-button:disabled { cursor: default; opacity: .7; }
.machine-picker-button[aria-expanded="true"] { border-color: var(--accent); }
.machine-picker-label { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.machine-picker-caret { flex: none; color: var(--muted); }
.machine-picker-menu {
  width: max(240px, 100%); min-width: 240px;
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--strong-line); border-radius: 8px;
  background: var(--panel); box-shadow: var(--lift); text-align: left;
}
.machine-picker-search {
  margin: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--pale); color: var(--ink);
  font: inherit; font-size: 12px;
}
.machine-picker-list { max-height: 220px; overflow-y: auto; padding: 0 3px 3px; }
.machine-picker-option {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px; cursor: pointer; font-size: 12.5px;
}
.machine-picker-option .dot.online { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.machine-picker-option .dot.offline { background: var(--warn); }
.machine-picker-option.active, .machine-picker-option:hover { background: var(--pale); }
.machine-picker-option.current { font-weight: 600; }
.machine-picker-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); }
.machine-picker-meta { flex: none; color: var(--faint); font-size: 10.5px; }
.machine-picker-check { flex: none; color: var(--accent); }
.machine-picker-option.offline { color: var(--muted); cursor: default; }
.machine-picker-option.offline:hover, .machine-picker-option.offline.active { background: none; }
.machine-picker-empty { padding: 10px 12px; color: var(--muted); font-size: 12px; }
.link-button {
  padding: 0; border: none; background: none; color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--strong-line); cursor: pointer;
}
.link-button:hover { text-decoration-color: var(--ink); }
.link-button:disabled { color: var(--muted); text-decoration: none; cursor: default; }

.favorites { margin: 20px 0 16px; text-align: left; }
.favorites-title { margin: 0 0 8px !important; color: var(--faint); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.favorites-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.favorite-card { display: flex; align-items: stretch; gap: 2px; min-width: 0; }
.favorite-open {
  flex: 1; min-width: 0; min-height: 34px; padding: 6px 8px; border-radius: 7px;
  font-size: 12px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.favorite-card .unstar {
  flex: none; width: 20px; padding: 0 !important; border: 0; background: none;
  color: var(--faint); font-size: 12px; line-height: 1; opacity: 0;
}
.favorite-card:hover .unstar, .favorite-card:focus-within .unstar { opacity: 1; }
.favorite-card .unstar:hover { color: var(--accent); }
.browse-toggle { margin-top: 4px; font-size: 11px; }
.session-browser { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.session-browser[hidden] { display: none; }

.session-row { position: relative; display: flex; align-items: stretch; }
.session-row .session-button { flex: 1; min-width: 0; }
.session-row .star {
  flex: none; width: 24px; padding: 0 !important; border: 0; background: none;
  font-size: 12px; line-height: 1; opacity: 0;
}
.session-row:hover .star, .session-row:focus-within .star, .session-row .star[aria-pressed="true"] { opacity: 1; }

.install-extension { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0; padding-top: 7px !important; color: var(--accent); }
.message { margin: 0 0 28px; min-width: 0; }
.message-label { display: block; margin-bottom: 8px; color: var(--assistant); font-size: 11px; font-weight: 600; }
.message-body { margin: 0; font: inherit; line-height: 1.7; overflow-wrap: anywhere; }

.message-body:not(.markdown) { white-space: pre-wrap; }

.message.user { display: flex; flex-direction: column; align-items: flex-end; }
.message.user .message-label { display: none; }
.message.user .message-body {
  max-width: 78%; padding: 10px 16px; text-align: left;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line)); border-radius: 18px 18px 4px 18px;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
}
.message.notice { padding: 10px 14px; border-left: 2px solid var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); color: var(--warn); font-size: 12px; }


.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 14px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 {
  margin: 22px 0 10px; line-height: 1.35; font-weight: 600;
}
.markdown h1 { font-size: 19px; }
.markdown h2 { font-size: 16px; }
.markdown h3 { font-size: 14px; }
.markdown h4, .markdown h5, .markdown h6 { font-size: 13px; }
.markdown ul, .markdown ol { margin: 0 0 14px; padding-left: 24px; }
.markdown li { margin: 4px 0; }
.markdown blockquote {
  margin: 0 0 14px; padding: 2px 0 2px 14px;
  border-left: 2px solid var(--strong-line); color: var(--muted);
}
.markdown hr { margin: 20px 0; border: 0; border-top: 1px solid var(--line); }
.markdown .table-scroll { margin: 0 0 14px; overflow-x: auto; }
.markdown .markdown-table { border-collapse: collapse; width: auto; min-width: 100%; font-size: 13px; }
.markdown .markdown-table th, .markdown .markdown-table td {
  padding: 7px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top;
}
.markdown .markdown-table th { background: color-mix(in srgb, var(--line) 35%, transparent); font-weight: 600; }
.markdown a { color: var(--accent); }
.markdown code {
  padding: 1px 5px; border-radius: 4px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  font: 12px var(--mono);
}
.markdown .code-block {
  margin: 0 0 14px; padding: 12px 14px; overflow-x: auto;
  border: 1px solid var(--line); border-radius: 6px; background: var(--recess);
  font: 12px/1.6 var(--mono); white-space: pre;
}
.markdown .code-block code { padding: 0; background: none; font: inherit; }
/* Code reads as code: the colours say what the words are, the way every
 * editor the reader lives in says it. Two themes' worth live in the vars. */
.tok-com { color: var(--faint); font-style: italic; }
.tok-str { color: var(--ok); }
.tok-num { color: var(--warn); }
.tok-key { color: var(--accent); }
.tok-fn { color: var(--user); }
.tok-type, .tok-var { color: var(--assistant); }
.tok-tag { color: var(--accent); }
.tok-attr { color: var(--user); }
.tok-punc { color: var(--muted); }
.tok-line { display: block; }
.tok-head { color: var(--faint); }
.tok-hunk { color: var(--muted); font-style: italic; }
.tok-add { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.tok-del { color: var(--error); background: color-mix(in srgb, var(--error) 12%, transparent); }
.tool { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--recess); }
.tool summary {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 12px; cursor: pointer;
  list-style: none; font-size: 12px;
}
.tool summary::-webkit-details-marker { display: none; }
.tool summary::before { content: "\25B8"; align-self: center; color: var(--faint); font-size: 9px; transition: transform .12s ease; }
.tool[open] summary::before { transform: rotate(90deg); }

.tool-name { color: var(--ink); font-weight: 600; }
.tool-title { min-width: 0; flex: 1; color: var(--muted); font: 11px/1.5 var(--mono); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tool-title[hidden] { display: none; }
.tool-state { margin-left: auto; color: var(--faint); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.tool[data-state=error] .tool-state { color: var(--error); }
.tool[data-state=done] .tool-state { color: var(--ok); }
.tool pre { max-height: 360px; margin: 0; padding: 14px; overflow: auto; border-top: 1px solid var(--line); font: 12px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

.thought { margin: 0 0 14px; }
.thought summary { display: flex; align-items: center; gap: 7px; padding: 3px 2px; cursor: pointer; list-style: none; color: var(--muted); }
.thought summary::-webkit-details-marker { display: none; }
.thought-mark { color: var(--faint); font-size: 9px; transition: transform .12s ease; }
.thought[open] .thought-mark { transform: rotate(90deg); }
.thought-title { font-size: 12px; font-style: italic; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.thought-body { margin: 4px 0 0 16px; padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: 12px; }

/* A single, quiet line for the work between messages. Existing keyed tool
 * views live inside, so toggling this never loses their individual folds. */
.activity-group { margin: 0 0 18px; min-width: 0; }
.activity-summary { display: flex; align-items: center; gap: 7px; min-height: 26px; padding: 2px 0; list-style: none; cursor: pointer; color: var(--muted); font-size: 11px; }
.activity-summary::-webkit-details-marker { display: none; }
.activity-summary:hover { color: var(--ink); }
.activity-mark { flex: none; font-size: 10px; }
.activity-group[open] > summary .activity-mark { transform: rotate(90deg); }
.activity-title { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.activity-state { flex: none; margin-left: auto; color: var(--muted); font-size: 10px; }
.activity-group[data-state=running] > summary .activity-mark { color: var(--accent); }
.activity-group[data-state=error] > summary .activity-state { color: var(--error); }
.activity-body { margin-top: 6px; padding-left: 10px; border-left: 1px solid var(--line); }
.activity-body > .message-footer { margin: 0 0 12px; }
.activity-group + .message-footer { margin-top: 0; }

.working { display: flex; align-items: center; gap: 9px; margin: 2px 0 20px; color: var(--muted); font-size: 12px; }
.working[hidden] { display: none; }
.working-mark { width: 18px; height: 18px; animation: pulse 1.6s ease-in-out infinite; }
.working-dots { display: inline-flex; gap: 3px; }
.working-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--faint); animation: blink 1.2s ease-in-out infinite; }
.working-dots i:nth-child(2) { animation-delay: .18s; }
.working-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) {
  .working-mark, .working-dots i { animation: none; }
}
.jump-bottom { position: absolute; right: 28px; bottom: 170px; background: var(--raised); font-size: 11px; box-shadow: var(--lift); }

.load-earlier { display: block; margin: 0 auto 20px; font-size: 11px; background: var(--raised); }

.composer { padding: 4px max(14px, calc((100% - 780px) / 2)) max(8px, env(safe-area-inset-bottom)); position: relative; }
body.no-target .composer, body.no-target #extensions-button, body.no-target #browse-sessions { display: none; }

/*
 * One row under the input: what answers, how hard, how much context is spent,
 * how fast, and the mark that compacts it. The hint between the menus and the
 * readouts is the only thing in here allowed to give up space, so a narrow
 * pane loses a sentence rather than a number.
 */
.composer-box {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 5px 5px 5px 4px; border: 1px solid var(--strong-line); border-radius: 12px;
  background: var(--composer); box-shadow: var(--composer-shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--strong-line));
  box-shadow: var(--composer-shadow), 0 0 0 3px var(--pale);
}
.composer textarea {
  flex: 1; min-width: 0; min-height: 22px; max-height: 160px;
  padding: 5px 7px; border: 0; background: none;
  font-size: 13px; line-height: 1.45; resize: none; overflow-y: auto;
}
.composer textarea:focus { border: 0; outline: none; box-shadow: none; }
/* The paperclip sits inside the box, the way a chat input is expected to. */
.composer-box > .icon-button { align-self: flex-end; margin-bottom: 1px; flex: none; }
.composer-send { display: flex; align-items: center; gap: 5px; position: relative; }
.composer-send button { min-height: 26px; padding: 0 11px; border-radius: 6px; font-size: 11px; }
/*
 * Sending while a turn is running has two meanings, so the button carries a
 * caret that opens them. One control that says what it will do, rather than a
 * mode set somewhere else and a button that silently obeys it.
 */
.send-split { display: flex; align-items: center; }
/* Hidden elements still count for :only-child. Start with a fully rounded
 * Send; flatten its right edge only while the caret is actually displayed. */
.send-split > button { border-radius: 6px; padding: 0 11px; }
.send-split:has(> .send-caret:not([hidden])) > button:first-child { border-radius: 6px 0 0 6px; }
.send-split > .send-caret { border-radius: 0 6px 6px 0; padding: 0 6px; }
.composer-send .send-caret { display: inline-flex; align-items: center; justify-content: center; }
.composer-send .send-caret[hidden] { display: none; }
.send-caret svg { display: block; }
.send-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 6;
  display: flex; flex-direction: column; min-width: 150px; padding: 4px;
  border: 1px solid var(--strong-line); border-radius: 9px; background: var(--panel);
  box-shadow: var(--lift);
}
.send-menu[hidden] { display: none; }
.send-menu button {
  text-align: left; border: 0; background: none; border-radius: 6px;
  min-height: 26px; padding: 0 8px; font-size: 11px; color: var(--ink);
}
.send-menu button:hover { background: var(--pale); }
.send-menu button[aria-checked="true"] { color: var(--accent); font-weight: 600; }

.composer-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow: hidden; margin-top: 3px; padding: 0 3px; }
/* Only the hint yields: every other thing in this row is an answer. */
.composer-actions > #composer-hint { flex: 1 1 0; min-width: 0; margin-right: auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.composer-actions > .run-stats, .composer-actions > .compact-session { flex: 0 0 auto; }
/* The meter yields: it is the readout that compresses, bar and numbers both,
 * while a button that fell to another line would say nothing at all. */
.composer-actions > .context-meter { flex: 0 1 auto; min-width: 14px; }
.composer-actions > .daemon-version { flex: none; margin: 0 0 0 auto; overflow: visible; }
/* Small and quiet, because it is rarely what anyone came for. */
.compact-session { height: 20px; min-height: 20px; padding: 0 8px; border-radius: 10px; font-size: 10px; line-height: 1; color: var(--muted); }
.compact-session:hover:not(:disabled) { color: var(--accent); }
.composer-actions label { flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.composer-actions label > span { flex: none; color: var(--faint); }
.composer-actions button { font-size: 11px; }
.composer-actions select { flex: 0 1 auto; min-width: 58px; max-width: 150px; min-height: 22px; padding: 1px 4px; border-radius: 4px; font-size: 10px; }

.command-menu {
  position: absolute;
  left: max(32px, calc((100% - 780px) / 2));
  right: max(32px, calc((100% - 780px) / 2));
  bottom: calc(100% - 14px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--lift);
}
.command-list { max-height: 320px; overflow-y: auto; padding: 3px; }
.command-option { display: flex; flex-direction: column; gap: 2px; padding: 5px 9px; border-radius: 4px; cursor: pointer; }
.command-option-head { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.command-option strong { color: var(--ink); font-family: var(--mono); font-size: 12px; font-weight: 600; white-space: nowrap; }
.command-hint { color: var(--faint); font-family: var(--mono); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-description { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-option.active, .command-option:hover { background: var(--pale); }
.command-option.active strong { color: var(--accent); }
.command-empty { padding: 10px 12px; color: var(--muted); font-size: 12px; }
.command-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 5px 10px; border-top: 1px solid var(--line);
  background: var(--raised); color: var(--faint); font-size: 10.5px; white-space: nowrap;
}
.command-foot span:last-child { overflow: hidden; text-overflow: ellipsis; }
.approval { padding: 18px 28px; max-height: 40dvh; overflow: auto; border-top: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.approval h2 { font-size: 13px; }
.approval form { display: grid; gap: 14px; }
.approval input, .approval textarea, .approval select { width: 100%; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.approval p { font-size: 12px; }
.approval pre { white-space: pre-wrap; overflow-wrap: anywhere; }
dialog {  width: min(620px, calc(100vw - 32px)); max-height: 85dvh; padding: 28px; border: 1px solid var(--strong-line); border-radius: 8px; color: var(--ink); background: var(--panel); overflow-wrap: anywhere; }
dialog::backdrop { background: var(--veil); }

/* One settings window, shared by the existing controls rather than copies of
 * their state. Calm sections, a theme preview, and a scrollable content pane. */
dialog.settings-dialog { width: min(760px, calc(100vw - 32px)); max-width: none; height: min(570px, calc(100dvh - 32px)); max-height: none; padding: 0; border-radius: 18px; overflow: hidden; box-shadow: var(--lift); }
.settings-dialog[open] { display: flex; flex-direction: column; }
.settings-dialog::backdrop { background: color-mix(in srgb, var(--bg) 60%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.settings-header { display: flex; align-items: center; justify-content: space-between; flex: none; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(110deg, var(--pale), transparent 65%); }
.settings-eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.settings-header h2 { margin: 0; font-size: 24px; line-height: 1.15; letter-spacing: -.02em; }
.settings-close { width: 34px; min-height: 34px; padding: 0; border-radius: 50%; font-size: 20px; }
.settings-layout { display: grid; grid-template-columns: 164px minmax(0, 1fr); flex: 1; min-height: 0; }
.settings-tabs { display: flex; flex-direction: column; gap: 5px; padding: 14px 10px; border-right: 1px solid var(--line); background: var(--recess); overflow-y: auto; }
.settings-tabs button { display: flex; align-items: center; gap: 10px; min-height: 40px; flex: none; padding: 8px 10px; border: 1px solid transparent; border-radius: 9px; text-align: left; background: transparent; color: var(--muted); font-size: 12px; }
.settings-tabs button:not([aria-selected=true]):hover:not(:disabled) { background: var(--pale); color: var(--ink); border-color: transparent; }
.settings-tabs button[aria-selected=true] { background: var(--pale); border-color: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent); font-weight: 650; }
.settings-tabs svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.settings-content { padding: 24px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.settings-content h3 { margin: 0 0 5px; font-size: 17px; font-weight: 650; }
.settings-content h4 { margin: 22px 0 10px; font-size: 12px; font-weight: 650; }
.settings-description { display: block; margin: 0 0 20px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.settings-card { border: 1px solid var(--line); border-radius: 12px; background: var(--raised); overflow: hidden; margin-bottom: 14px; }
.settings-row { position: relative; display: flex; align-items: center; justify-content: space-between; flex-direction: row; grid-template-columns: none; gap: 16px; min-height: 70px; padding: 14px; margin: 0; color: var(--ink); font-size: 12px; }
.settings-row + .settings-row { border-top: 1px solid var(--line); }
.settings-row > span { display: grid; gap: 5px; flex: 1; min-width: 0; }
.settings-row strong { font-size: 12px; font-weight: 650; }
.settings-row small { font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.5; }
.settings-row select { width: auto; max-width: 48%; min-height: 34px; padding: 5px 8px; border: 1px solid var(--strong-line); border-radius: 7px; font-size: 12px; background: var(--panel); }
.settings-row > i { flex: none; }
.settings-preview { margin: 0 14px 14px; border: 1px solid var(--strong-line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.settings-preview-bar { display: flex; align-items: center; gap: 4px; padding: 7px 9px; border-bottom: 1px solid var(--line); background: var(--panel); }
.settings-preview-bar i { width: 5px; height: 5px; border-radius: 50%; background: var(--strong-line); }
.settings-preview-bar i:first-child { background: var(--accent); }
.settings-preview-bar span { margin-left: auto; color: var(--muted); font-size: 9px; }
.settings-preview-body { display: grid; gap: 7px; padding: 12px 16px; }
.settings-preview-body span { width: 65%; height: 5px; border-radius: 5px; background: var(--strong-line); }
.settings-preview-body .preview-prompt { width: 35%; height: 14px; justify-self: end; background: var(--pale); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.settings-preview-body .preview-short { width: 45%; }
.settings-preview-body .preview-accent { width: 20%; background: var(--accent); opacity: .8; }
.settings-note { margin: 12px 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.settings-action { display: flex; align-items: flex-start; width: 100%; padding: 14px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); color: var(--ink); text-align: left; gap: 5px; }
.settings-action .menu-option-title { font-size: 12px; font-weight: 650; }
.settings-action .menu-option-subtitle { color: var(--muted); font-size: 11px; line-height: 1.5; }
.settings-device, .settings-identity { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; min-width: 0; }
.settings-device > div, .settings-identity > div { min-width: 0; }
.settings-device strong { font-size: 15px; }
.settings-device .settings-description, .settings-identity .settings-description { margin: 4px 0 0; font-size: 11px; }
.settings-device-mark, .settings-account-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--pale); color: var(--accent); font-size: 21px; }
.settings-dialog .account-name { display: block; max-width: none; overflow: visible; white-space: normal; overflow-wrap: anywhere; color: var(--ink); font-size: 14px; font-weight: 600; }
.settings-signin { min-height: 36px; border-radius: 8px; }
.settings-footer { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); }
.settings-footer span { color: var(--muted); font-size: 11px; }
.settings-footer button { min-width: 76px; min-height: 34px; border-radius: 8px; }
@media (max-width: 620px) {
  dialog.settings-dialog { width: calc(100vw - 20px); height: min(660px, calc(100dvh - 20px)); border-radius: 14px; }
  .settings-header { padding: 16px; }
  .settings-header h2 { font-size: 21px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .settings-tabs { flex-direction: row; gap: 3px; padding: 7px; border-right: 0; border-bottom: 1px solid var(--line); overflow: auto; }
  .settings-tabs button { justify-content: center; flex: 1 0 auto; min-height: 40px; padding: 8px; font-size: 11px; }
  .settings-tabs svg { display: none; }
  .settings-content { padding: 18px 14px; }
  .settings-row { gap: 10px; padding: 12px; }
  .settings-row select { max-width: 50%; min-height: 40px; }
  .settings-row small { font-size: 11px; }
  .settings-footer { padding: 12px 14px; }
  .settings-close, .settings-footer button, .settings-signin { min-height: 40px; }
}
dialog .section-heading { margin-bottom: 24px; }
#machine-dialog { width: min(420px, calc(100vw - 32px)); }
#machine-choices { margin-top: 16px; gap: 8px; }
#machine-choices .machine-button { padding: 11px 12px; border-color: var(--line); }
dialog li { padding: 0 0 12px; }
code { padding: 2px 5px; border-radius: 3px; color: var(--accent); background: var(--pale); font-family: var(--mono); overflow-wrap: anywhere; }


.help-downloads { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--pale); }
.segmented button { padding: 5px 11px; border: 0; border-radius: 5px; color: var(--soft-ink); background: none; font: inherit; font-size: 12px; cursor: pointer; }
.segmented button.on { color: var(--ink); background: var(--panel); box-shadow: 0 1px 2px var(--veil); }
.agent-line { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.agent-command { flex: 1; max-height: 6.5em; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--pale); font-size: 12px; line-height: 1.5; overflow: auto; white-space: pre-wrap; }
.agent-copy { flex: none; }
.setup-hint { margin-top: 18px; }
/* First-run setup: the one card on a fresh install that says what is missing
 * and asks the one question that fixes it. */
.setup-panel { width: min(420px, 100%); margin: 18px auto 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.setup-title { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.setup-panel .small { margin: 0 0 8px; }
.setup-providers { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.setup-choice { font-size: 12px; padding: 5px 10px; }
.setup-interaction { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.setup-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.setup-links code { padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; }
.setup-answer { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.setup-answer input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font-size: 12px; }
.setup-answer button { font-size: 12px; padding: 5px 10px; }
.setup-panel [role="status"]:empty { display: none; }

.toasts {
  position: fixed; z-index: 60; right: 16px; bottom: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  max-width: min(420px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--strong-line); border-radius: 8px;
  background: var(--panel); box-shadow: var(--lift);
  color: var(--ink); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere;
}
.toast.bad { border-color: color-mix(in srgb, var(--warn) 45%, var(--strong-line)); }
.toast pre { margin: 6px 0 0; max-height: 9em; overflow: auto; color: var(--muted); font: 11px var(--mono); white-space: pre-wrap; }
.toast .toast-close { flex: none; width: 20px; padding: 0 !important; border: 0; background: none; color: var(--faint); font-size: 13px; line-height: 1; }
.toast .toast-close:hover { color: var(--ink); }
#install-dialog { width: min(480px, calc(100vw - 32px)); }
#install-dialog label { display: block; margin-bottom: 10px; font-size: 12px; }
#install-dialog input { width: 100%; margin-top: 6px; font-family: var(--mono); }
#install-dialog .primary { margin-top: 14px; }

@media (max-width: 1100px) {
  #composer-hint { display: none; }
}

/*
 * A split pane is narrower than a window, and the row must not answer by
 * wrapping: the readout yields instead. Below this width the words "Model" and
 * "Effort" go, because each menu already names itself.
 */
@media (max-width: 700px) {
  .composer-actions label > span { display: none; }
  .composer-actions select { max-width: 130px; }
}
@media (max-width: 700px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .top-actions { gap: 4px; }
  .account-name { display: none; }
  .welcome { padding: 0 16px 28px; }
  .auth-card { padding: 24px 22px 14px; }

  .conversation { width: 100%; }
  .session-header { padding: 6px 10px; gap: 8px; grid-template-columns: auto minmax(0, 1fr) auto; }
  .session-header button { padding: 3px 6px; font-size: 11px; }
  /* Stay on one row: a split pane is narrow long before the window is, and
   * the title alone is what belongs there. The computer and folder are on the
   * hover popover, which truncates rather than asking the header for space. */
  .session-heading { gap: 6px; }
  .session-heading h1 { font-size: 12px; }
  .transcript { padding: 28px 20px; }
  .message { margin-bottom: 28px; }
  .composer-actions { gap: 8px; }
  .composer-actions select { max-width: 145px; }
  .approval { padding: 18px; }
  .jump-bottom { right: 16px; bottom: 185px; }
  .banner { padding: 12px 16px; }
}

@media (max-width: 700px) and (pointer: coarse) {
  .composer { padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
  input, select, textarea, .auth-card input, .search-label input,
  .composer textarea, .composer-actions select { font-size: 16px; }
}
@media (pointer: coarse) {
  button, select, input, .auth-card input, .auth-card .primary,
  .tool summary { min-height: 44px; }
  .tool summary { align-content: center; }

  .topbar button, .session-header button { min-height: 28px; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background .12s, border-color .12s, color .12s; }
}


.device-launcher { margin-top: 18px; display: grid; gap: 8px; justify-items: stretch; text-align: left; }
.launcher-title { margin: 0; font-weight: 600; }
.device-launcher .small { margin: 0 0 4px; }
.launcher-device {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; color: inherit; background: var(--card, transparent);
}
.launcher-device:hover { background: var(--hover, color-mix(in srgb, var(--ink) 6%, transparent)); }
.launcher-device .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }


.unlock-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(8, 10, 14, 0.72); backdrop-filter: blur(6px);
  color-scheme: dark light;
  font-family: "Segoe UI", system-ui, sans-serif;
}
.unlock-card {
  width: min(22rem, 90vw); display: grid; gap: .7rem;
  padding: 1.4rem 1.5rem; border-radius: 14px;
  background: #14161a; color: #e9edf2; border: 1px solid #2b303a;
}
.unlock-card h1 { margin: 0 0 .2rem; font-size: 1.15rem; font-weight: 600; }
.unlock-card p { margin: 0 0 .4rem; color: #9aa4b2; font-size: .85rem; line-height: 1.45; }
.unlock-card input, .unlock-card button {
  font: inherit; padding: .6rem .7rem; border-radius: .5rem; border: 1px solid #2b303a;
}
.unlock-card input { background: #1b1e24; color: inherit; }
.unlock-card button { background: #3b82f6; color: #fff; border-color: transparent; cursor: pointer; }
.unlock-card button[disabled] { opacity: .6; cursor: default; }
.unlock-error { color: #f87171; font-size: .85rem; min-height: 1.2em; }

/*
 * The progress overlay: what a session is doing, for a window nobody is
 * reading.
 *
 * It sits over the transcript rather than beside it, because the transcript is
 * still there and the point is to be glanceable: a session you are watching
 * shows its work, and the same session stepped away from shows one sentence
 * about it. Hovering keeps an existing report readable; a click brings the
 * work back. Focused/hovered panes then need a fresh minute of inactivity.
 */
.session-overlay {
  position: absolute; inset: 0; z-index: 4; display: flex;
  align-items: center; justify-content: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.session-overlay[hidden] { display: none; }
.overlay-card {
  max-width: 420px; max-height: 100%; overflow: auto; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--strong-line); background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
}
.overlay-state {
  display: flex; align-items: center; gap: 7px; margin: 0 0 6px;
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint);
}
.overlay-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.session-overlay[data-state="idle"] .overlay-dot { background: var(--muted); }
.session-overlay[data-state="waiting"] .overlay-dot { background: var(--warn); }
.overlay-age { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; }
.overlay-text { margin: 0; min-width: 0; font-size: 13px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.overlay-text:not(.markdown) { white-space: pre-line; }
.overlay-text.markdown { white-space: normal; }
.overlay-text.markdown > :first-child { margin-top: 0; }
.overlay-text.markdown > :last-child { margin-bottom: 0; }
/* An explicitly requested report stays open, in flow, without covering the
 * transcript's approval UI or stopping the user from typing a message. */
.session-overlay.manual-summary { position: relative; inset: auto; flex: none; padding: 8px 14px; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.manual-summary .overlay-card { display: flex; flex-direction: column; width: 100%; max-width: 780px; max-height: min(320px, 40dvh); }
.manual-summary .overlay-text { min-height: 0; overflow: auto; }
.manual-summary .overlay-state { flex: none; }
.summary-panel-actions { display: flex; justify-content: flex-end; gap: 6px; flex: none; margin-top: 8px; }
.summary-panel-actions button { font-size: 11px; }
.summary-editor { padding-bottom: 10px; }
.summary-prompt-label { display: block; margin: 0; padding: 0 14px 7px; font-size: 12px; font-weight: 600; }
#summary-prompt { display: block; width: calc(100% - 28px); min-height: 135px; max-height: 300px; margin: 0 14px; padding: 10px; resize: vertical; border: 1px solid var(--strong-line); border-radius: 8px; background: var(--panel); color: var(--ink); font: 12px/1.5 var(--ui); }
.summary-editor .settings-note { margin: 9px 14px; font-size: 11px; }
.summary-editor-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin: 10px 14px 0; }
.summary-editor-actions button { min-height: 34px; font-size: 11px; border-radius: 7px; }

/* The settings row beside the switch: a label and a menu, in the same shape. */
.menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 28px; padding: 3px 6px; font-size: 12px; color: var(--text);
}
.menu-row select {
  min-height: 22px; padding: 1px 4px; border-radius: 4px; font-size: 11px;
}
.composer > .model-picker { z-index: 7; }
.composer > .model-picker .machine-picker-menu { width: min(320px, calc(100vw - 24px)); }
.composer-actions .model-picker-button { flex: 0 1 auto; min-width: 58px; max-width: 170px; min-height: 22px; gap: 4px; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 500; }
.composer-actions .model-picker-button:disabled { opacity: .5; cursor: not-allowed; }
.menu-note { margin: 2px 6px 4px; font-size: 10px; line-height: 1.4; }

/*
 * Asking the conversation, out loud.
 *
 * Purple because it is the other thing a mouth is for, and beside Compact
 * because that is where the row of "about this session" controls lives. It is
 * a question, not a message: nothing here reaches the agent.
 */
.ask-session {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; min-height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 10px; line-height: 1; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.ask-session:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ask-session svg { display: block; }
/* Listening is a state, not a message: the mark pulses until it is stopped. */
.ask-session.listening { background: var(--accent); color: #fff; border-color: var(--accent); }
.ask-session.listening svg { animation: ask-pulse 1.1s ease-in-out infinite; }
@keyframes ask-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .ask-session.listening svg { animation: none; } }
/*
 * The reading controls, which exist only while something is being read.
 *
 * They arrive with the narration and leave with it: a speed selector parked
 * where nobody is reading is a control with nothing to control.
 */
.narration-bar {
  display: flex; align-items: center; gap: 8px; padding: 3px 3px 4px;
  min-height: 0;
}
.narration-bar[hidden] { display: none; }
.narration-stop {
  height: 20px; min-height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 10px; line-height: 1; color: var(--muted);
}
.narration-stop:hover { color: var(--error, #c04a4a); }
.narration-speed select {
  min-height: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  font-size: 10px; color: var(--muted); background: none; border: 1px solid var(--strong-line);
}
.narration-phase { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; }

/* TEMPORARY: the top-bar entry to the first-run tour while it is designed. */
.tour-button { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.tour-button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: tour-beacon 2.4s ease-out infinite; }
@keyframes tour-beacon { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .tour-button::before { animation: none; } }
