/* Self-hosted original typefaces; the redesigned page structure is retained. */
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
/* Tokens: Multica-style neutrals (a faint cool cast, hue 286), one accent
   (azure), danger. Run states are the one status system: running = accent,
   succeeded = ok, failed = danger. `*-text` tokens are the readable (AA) text
   shade of a status colour. Surfaces: the app shell (= --sidebar) is the quiet
   outer frame; --background is the inset page canvas; --card holds bounded
   groups. theme.js sets <html data-theme> (Light, Dark, or the OS when System)
   before first paint; web/tests/theme.test.js checks contrast per theme. */
:root {
  --radius: 0.5rem;
  --background: oklch(0.988 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --primary: oklch(0.21 0.006 285.885);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.967 0.001 286.375);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.505 0.016 285.938);
  --faint-foreground: oklch(0.606 0.016 285.938);
  --border: oklch(0.945 0.003 286.32);
  --surface-border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.552 0.016 285.938);
  --ring-soft: oklch(0.705 0.015 286.067 / 50%);
  --hairline: oklch(0.141 0.005 285.823 / 10%);
  --sidebar-width: 256px;
  --sidebar: oklch(0.964 0.001 286.375);
  --sidebar-active: oklch(0.935 0.003 286.375);
  --surface-hover: oklch(0.967 0.001 286.375);
  --surface-selected: oklch(0.95 0.002 286.375);
  --accent-brand: oklch(0.561 0.195 256.41);
  --accent-soft: oklch(0.561 0.195 256.41 / 10%);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-soft: oklch(0.577 0.245 27.325 / 10%);
  --ok: oklch(0.6 0.13 155);
  /* Project colours (issue-rules.js PROJECT_COLORS): one hue each, readable as a dot or an edge on a card. */
  --project-blue: oklch(0.6 0.17 255);
  --project-green: oklch(0.6 0.15 150);
  --project-orange: oklch(0.68 0.17 55);
  --project-purple: oklch(0.58 0.2 300);
  --project-pink: oklch(0.65 0.2 350);
  --project-teal: oklch(0.62 0.12 195);
  --project-red: oklch(0.6 0.21 25);
  --project-yellow: oklch(0.78 0.16 90);
  --project-indigo: oklch(0.52 0.2 275);
  --project-gray: oklch(0.6 0.02 260);
  /* Chart series (charts.js), in fixed order: the dataviz skill's categorical set, checked with its
     validate_palette.js on --card in both themes (light: three slots under 3:1, so every chart has a
     legend, tooltips and a table). Other is always the neutral last series. */
  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --chart-3: #1baf7a;
  --chart-4: #eda100;
  --chart-5: #e87ba4;
  --chart-other: oklch(0.8 0.01 286);
  --ok-soft: oklch(0.6 0.13 155 / 12%);
  --warn: oklch(0.75 0.15 75);
  --warn-soft: oklch(0.75 0.15 75 / 14%);
  --accent-text: oklch(0.52 0.19 256);
  --ok-text: oklch(0.47 0.11 155);
  --warn-text: oklch(0.5 0.12 65);
  --destructive-text: oklch(0.52 0.22 27.325);
  --canvas-dot: oklch(0.141 0.005 285.823 / 12%);
  --surface-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 1px 1px rgb(15 23 42 / 0.03);
  --menu-shadow: 0 8px 24px rgb(15 23 42 / 0.08), 0 2px 6px rgb(15 23 42 / 0.05);
  --floating-shadow: 0 16px 40px rgb(15 23 42 / 0.14), 0 3px 10px rgb(15 23 42 / 0.08);
  --scrollbar-thumb: rgb(0 0 0 / 10%);
  --scrollbar-thumb-hover: rgb(0 0 0 / 18%);
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Names introduced by the newer layouts reuse the palette above. */
  --font-heading: var(--font-sans);
  --heading: var(--foreground);
  --card-foreground: var(--foreground);
  --popover: var(--card);
  --popover-foreground: var(--foreground);
  --secondary-foreground: var(--foreground);
  --accent: var(--secondary);
  --accent-foreground: var(--foreground);
  --accent-brand-foreground: var(--primary-foreground);
  --accent-brand-ink: var(--accent-text);
  --success: var(--ok);
  --success-foreground: var(--ok-text);
  --surface-inverse: var(--primary);
  --surface-inverse-foreground: var(--primary-foreground);
  --surface-inverse-accent: var(--accent-brand);
  --sidebar-foreground: var(--foreground);
  --sidebar-border: var(--border);
  --sidebar-active-foreground: var(--foreground);
  --sidebar-marker: var(--accent-brand);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --background: oklch(0.18 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --primary: oklch(0.92 0.004 286.32);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --secondary: oklch(0.274 0.006 286.033);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.715 0.015 286.067);
  --faint-foreground: oklch(0.6 0.015 286.067);
  --border: oklch(1 0 0 / 6%);
  --surface-border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.552 0.016 285.938);
  --ring-soft: oklch(0.552 0.016 285.938 / 50%);
  --hairline: oklch(1 0 0 / 10%);
  --sidebar: oklch(0.21 0.006 285.885);
  --sidebar-active: oklch(0.274 0.006 286.033);
  --surface-hover: oklch(0.274 0.006 286.033);
  --surface-selected: oklch(0.3 0.006 286.033);
  --accent-brand: oklch(0.65 0.16 255);
  --accent-soft: oklch(0.65 0.16 255 / 18%);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-soft: oklch(0.704 0.191 22.216 / 15%);
  --ok: oklch(0.72 0.14 155);
  --project-blue: oklch(0.7 0.15 255);
  --project-green: oklch(0.72 0.15 150);
  --project-orange: oklch(0.76 0.16 55);
  --project-purple: oklch(0.7 0.18 300);
  --project-pink: oklch(0.74 0.18 350);
  --project-teal: oklch(0.74 0.12 195);
  --project-red: oklch(0.7 0.19 25);
  --project-yellow: oklch(0.84 0.15 90);
  --project-indigo: oklch(0.66 0.18 275);
  --project-gray: oklch(0.7 0.02 260);
  --chart-1: #3987e5;
  --chart-2: #d95926;
  --chart-3: #199e70;
  --chart-4: #c98500;
  --chart-5: #d55181;
  --chart-other: oklch(0.45 0.01 286);
  --ok-soft: oklch(0.72 0.14 155 / 15%);
  --warn: oklch(0.78 0.14 75);
  --warn-soft: oklch(0.78 0.14 75 / 16%);
  --accent-text: oklch(0.74 0.14 250);
  --ok-text: oklch(0.76 0.13 155);
  --warn-text: oklch(0.82 0.13 80);
  --destructive-text: oklch(0.74 0.17 22.216);
  --canvas-dot: oklch(1 0 0 / 10%);
  --surface-shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 1px 1px rgb(0 0 0 / 0.16);
  --menu-shadow: 0 10px 28px rgb(0 0 0 / 0.3), 0 2px 8px rgb(0 0 0 / 0.18);
  --floating-shadow: 0 20px 48px rgb(0 0 0 / 0.46), 0 4px 12px rgb(0 0 0 / 0.28);
  --scrollbar-thumb: rgb(255 255 255 / 8%);
  --scrollbar-thumb-hover: rgb(255 255 255 / 18%);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
[data-theme-switching] *,
[data-theme-switching] *::before {
  transition: none !important;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--sidebar);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.43;
  -webkit-font-smoothing: antialiased;
  font-synthesis-weight: none;
}
/* Thin, quiet scrollbars everywhere. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
code,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
/* A link inside running text is underlined, so colour is not the only cue (WCAG 1.4.1). */
:where(p, li, dd, .hint, .notice) a:not(.btn) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Shell ───────────────────────────────────────────────────────────────
   Multica layout: the sidebar sits on the quiet app frame and every page
   renders inside one inset, rounded canvas. There is no app-wide top bar;
   a page opens with a slim 48px header row inside the canvas. */
.shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--sidebar);
}
.sidebar {
  position: relative;
  width: var(--sidebar-width, 256px);
  flex: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
  gap: 2px;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 8px;
}
.workspace-switch {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--foreground);
  font-weight: 500;
}
.workspace-switch:hover {
  text-decoration: none;
  background: color-mix(in oklch, var(--sidebar-active) 70%, transparent);
}
.workspace-switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
.brand-glyph {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--primary);
}
.brand-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.sidebar-collapse {
  flex: none;
  margin-right: 10px;
  color: var(--muted-foreground);
}
.nav {
  display: grid;
  gap: 2px;
  align-content: start;
  padding-inline: 8px;
}
.nav a,
.nav .account-link {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 8px;
  min-width: 0;
  border-radius: 6px;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
}
.nav a:hover,
.nav .account-link:hover {
  background: color-mix(in oklch, var(--sidebar-active) 70%, transparent);
  color: var(--foreground);
  text-decoration: none;
}
.nav a[aria-current="page"],
.nav .account-link[aria-current="page"] {
  background: var(--sidebar-active);
  color: var(--foreground);
  font-weight: 500;
}
.nav a {
  position: relative;
}
.nav a .badge {
  background: none;
  height: auto;
  padding: 0;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav svg,
.icon {
  width: 16px;
  height: 16px;
  flex: none;
}
/* Groups: an unlabelled first one (Chat, Inbox), then Work and Team under a small label. */
.nav-group {
  display: grid;
  gap: 2px;
}
.nav-group + .nav-group {
  margin-top: 18px;
}
.nav-group-label {
  padding: 8px 8px 4px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-foot {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  margin-top: auto;
}
/* The footer: Profile (the user's name) — clicking it opens the account menu. */
.sidebar-account {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav .account-link {
  flex: 1;
  height: 40px;
  color: var(--foreground);
}
.account-avatar {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
}
.account-copy {
  display: grid;
  min-width: 0;
  line-height: 16px;
  white-space: normal;
}
.account-copy strong {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-copy > span {
  font-size: 12px;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The grabbable right edge; dragging it resizes the sidebar (see app.js sidebarResizeHandle). */
.sidebar-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  touch-action: none;
}
.sidebar-resize:hover,
.sidebar-resize:focus-visible {
  background: color-mix(in oklch, var(--sidebar-active) 70%, transparent);
  outline: none;
}
:root[data-sidebar-resizing] {
  user-select: none;
  cursor: col-resize;
}

/* The account menu: a dropout that opens upward from the profile button. Mirrors the context-menu look. */
.profile-menu {
  position: fixed;
  z-index: 60;
  min-width: 190px;
  padding: 4px;
  background: var(--popover);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--menu-shadow);
  display: grid;
  gap: 2px;
}
.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--foreground);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.profile-menu-item:hover,
.profile-menu-item:focus-visible {
  background: var(--muted);
  outline: none;
  text-decoration: none;
}
.profile-menu-item[data-tone="danger"] {
  color: var(--destructive-text);
}
.profile-menu .icon {
  width: 14px;
  height: 14px;
}

.app-workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 8px 8px 0;
}
.main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--background);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--surface-shadow);
}
.main:focus {
  outline: none;
}
/* A page switch keeps the page just left on top of the empty new pane until that one has drawn
   (app.js renderShell): same inset as the workspace padding, above the editor's review (30),
   below the account menu (60). After a beat it dims a little and the pointer says progress. */
.app-workspace {
  position: relative;
}
.main[data-leaving] {
  position: absolute;
  inset: 8px 8px 8px 0;
  z-index: 40;
  pointer-events: none;
}
.app-workspace:has(> .main[data-leaving]) {
  cursor: progress;
}
@media (prefers-reduced-motion: no-preference) {
  .main[data-leaving] {
    animation: page-leaving 200ms ease 250ms forwards;
  }
}
@keyframes page-leaving {
  to {
    opacity: 0.6;
  }
}
/* The page header: one slim row inside the canvas, title left, actions right. */
.topbar {
  height: 48px;
  min-height: 48px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.topbar h1 {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .btn {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  gap: 4px;
}
.topbar .btn .icon {
  width: 14px;
  height: 14px;
}
.topbar .btn[data-size="icon"] {
  width: 32px;
  padding: 0;
}
.page-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: -6px;
  border-radius: 6px;
  color: var(--muted-foreground);
}
.page-back:hover {
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}
.topbar .wf-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 0 -8px;
  max-width: 340px;
  min-width: 6ch;
  field-sizing: content;
  color: var(--foreground);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  height: 28px;
  padding: 0 8px;
  font-family: inherit;
  text-overflow: ellipsis;
}
.topbar .wf-title:hover {
  background: var(--muted);
}
.topbar .wf-title:focus {
  outline: none;
  background: var(--background);
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--ring-soft);
}
.topbar .wf-title[aria-invalid="true"] {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px var(--destructive-soft);
}
.spacer,
.topbar .spacer {
  flex: 1;
}
.page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.content {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  display: grid;
  gap: 20px;
  align-content: start;
}
.content h2 {
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

/* ── Primitives ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--foreground);
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s,
    opacity 0.15s;
}
/* A link styled as a button looks and hovers like one, not like a link. */
a.btn:hover {
  text-decoration: none;
}
@media (prefers-reduced-motion: no-preference) {
  .btn:active:not(:disabled) {
    transform: translateY(1px);
  }
}
.btn:focus-visible,
.input:focus-visible,
.nav a:focus-visible,
.palette-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring-soft);
  border-color: var(--ring);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn[data-variant="default"] {
  background: var(--primary);
  color: var(--primary-foreground);
}
.btn[data-variant="default"]:hover:not(:disabled) {
  background: color-mix(in oklch, var(--primary) 90%, transparent);
}
.btn[data-variant="outline"],
.btn:not([data-variant]) {
  background: var(--background);
  border-color: var(--border);
}
.btn[data-variant="outline"]:hover:not(:disabled),
.btn:not([data-variant]):hover:not(:disabled) {
  background: var(--muted);
}
:root[data-theme="dark"] .btn[data-variant="outline"],
:root[data-theme="dark"] .btn:not([data-variant]) {
  border-color: var(--input);
  background: color-mix(in oklch, var(--input) 30%, transparent);
}
:root[data-theme="dark"] .btn[data-variant="outline"]:hover:not(:disabled),
:root[data-theme="dark"] .btn:not([data-variant]):hover:not(:disabled) {
  background: color-mix(in oklch, var(--input) 50%, transparent);
}
.btn[data-variant="ghost"] {
  background: none;
}
.btn[data-variant="ghost"]:hover:not(:disabled) {
  background: var(--muted);
}
.btn[data-variant="destructive"] {
  background: var(--destructive-soft);
  color: var(--destructive-text);
}
.btn[data-variant="destructive"]:hover:not(:disabled) {
  background: color-mix(in oklch, var(--destructive) 20%, transparent);
}
.btn[data-size="sm"] {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
  gap: 4px;
  border-radius: 6px;
}
.btn[data-size="sm"] .icon {
  width: 14px;
  height: 14px;
}
.btn[data-size="icon"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
}

.input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: transparent;
  font-size: 14px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
:root[data-theme="dark"] .input {
  background: color-mix(in oklch, var(--input) 30%, transparent);
}
.input::placeholder {
  color: var(--muted-foreground);
}
@media (max-width: 767px), (pointer: coarse) {
  .input,
  select.input,
  textarea.input,
  .chat-prompt {
    font-size: 16px;
  }
}
textarea.input {
  height: auto;
  min-height: 64px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.5;
}
textarea.input.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  min-height: 180px;
}
select.input {
  padding-right: 6px;
}
.input[aria-invalid="true"] {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px var(--destructive-soft);
}
.field {
  display: grid;
  gap: 6px;
}
/* filePicker (lib.js): a file input as a drop zone; the native input is visually hidden inside it. */
.file-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 16px;
  row-gap: 6px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted-foreground);
  cursor: pointer;
}
.file-picker:hover,
.file-picker[data-state="over"] {
  background: var(--muted);
}
.file-picker[data-state="over"] {
  border-color: var(--ring);
}
.file-picker:has(input:focus-visible) {
  box-shadow: 0 0 0 3px var(--ring-soft);
  border-color: var(--ring);
}
.file-picker-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--muted);
  color: var(--foreground);
}
.file-picker:hover .file-picker-icon,
.file-picker[data-state="over"] .file-picker-icon {
  background: var(--background);
}
.file-picker-icon .icon {
  width: 16px;
  height: 16px;
}
.file-picker-text {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}
.file-picker-text strong {
  color: var(--foreground);
  font-weight: 500;
}
.file-picker-action {
  color: var(--accent-text);
  font-weight: 500;
}
.file-picker:hover .file-picker-action {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.file-picker-hint {
  grid-column: 2;
  font-size: 12px;
  line-height: 16px;
}
.file-picker[data-state="chosen"] {
  border-style: solid;
}
.agent-settings {
  display: grid;
  gap: 16px;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.agent-settings:disabled {
  opacity: 0.75;
}
.field > label,
.field-label {
  font-size: 13px;
  font-weight: 500;
}
.hint {
  font-size: 12px;
  color: var(--muted-foreground);
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  background: var(--card);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--surface-shadow);
  overflow: hidden;
}
.card-head {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-head h3 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  margin: 0;
}
.card-head h2 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
}
.card-head p {
  margin: 2px 0 0;
}
.card-body {
  padding: 0 16px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.card-body > .row {
  flex-wrap: wrap;
}
.card-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: color-mix(in oklch, var(--surface-hover) 70%, transparent);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--secondary);
  color: var(--muted-foreground);
  white-space: nowrap;
}
.badge[data-tone="accent"] {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.badge[data-tone="ok"] {
  background: var(--ok-soft);
  color: var(--ok-text);
}
.badge[data-tone="danger"] {
  background: var(--destructive-soft);
  color: var(--destructive-text);
}
/* The top bar's "Not ready · …" badge is a button: a click explains and opens the fix. */
button.topbar-ready {
  display: inline-block;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  line-height: 20px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.topbar-ready:hover {
  filter: brightness(0.96);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex: none;
}
@media (prefers-reduced-motion: no-preference) {
  [data-live] .dot {
    animation: pulse 1.2s ease-in-out infinite;
  }
}
@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.list-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
}
.list-row:hover {
  background: color-mix(in oklch, var(--accent) 40%, transparent);
}
.list-row p {
  margin: 0;
}
.list-row a.title {
  color: var(--foreground);
}
.list-row a.title::after {
  content: "";
  position: absolute;
  inset: 0;
}
.list-row a.title:focus-visible {
  outline: none;
}
.list-row:has(a.title:focus-visible) {
  box-shadow: inset 0 0 0 2px var(--ring);
}
.list-row .btn,
.list-row button {
  position: relative;
  z-index: 1;
}
.list-row .grow {
  flex: 1;
  min-width: 0;
}
.list-row .title {
  font-weight: 500;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted-foreground);
}
/* Multica's collection empty state: a muted icon circle, a short title, one line of help, the action. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 64px 24px;
  text-align: center;
  text-wrap: balance;
}
.empty-media {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--muted);
  color: var(--muted-foreground);
}
.empty-media .icon {
  width: 24px;
  height: 24px;
}
.empty-state h2,
.empty-state h3 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  letter-spacing: -0.025em;
}
.empty-state p {
  margin: -12px 0 0;
  max-width: 448px;
  font-size: 14px;
  line-height: 1.625;
  color: var(--muted-foreground);
}
.empty-state .row {
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.error-text {
  color: var(--destructive-text);
  font-size: 12px;
  margin: 0;
}
.error-text:empty {
  display: none;
}
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--floating-shadow);
  max-width: min(560px, calc(100vw - 32px));
}
.toast[data-tone="danger"] {
  background: var(--destructive);
  color: var(--primary-foreground);
}
.toast .toast-action {
  flex: none;
  background: transparent;
  color: inherit;
  border-color: color-mix(in oklch, currentColor 45%, transparent);
}
.toast .btn.toast-action,
:root[data-theme="dark"] .toast .btn.toast-action {
  background: transparent;
  color: inherit;
  border-color: color-mix(in oklch, currentColor 45%, transparent);
}
.toast .btn.toast-action:hover:not(:disabled),
:root[data-theme="dark"] .toast .btn.toast-action:hover:not(:disabled) {
  background: color-mix(in oklch, currentColor 12%, transparent);
}

/* ── Login ─────────────────────────────────────────────────────────────── */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--sidebar);
}
.login .card {
  width: min(400px, 100%);
}
.login-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

/* ── Editor ────────────────────────────────────────────────────────────── */
.editor {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 0 var(--inspector-w, 440px);
  grid-template-rows: minmax(0, 1fr) 0 auto;
  min-height: 0;
}
.editor > .canvas-wrap,
.editor > .inspector-resizer,
.editor > .side-panel {
  grid-row: 1;
}
.runs-resizer {
  grid-row: 2;
  grid-column: 1 / -1;
  position: relative;
  z-index: 3;
  cursor: row-resize;
  touch-action: none;
}
.runs-resizer::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}
.runs-resizer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: transparent;
  transition: background 0.12s;
}
.runs-resizer:hover::before,
.runs-resizer.dragging::before,
.runs-resizer:focus-visible::before {
  background: var(--ring, var(--muted-foreground));
}
.runs-resizer:focus-visible {
  outline: none;
}
.editor:has(.runs[data-collapsed="true"]) .runs-resizer {
  visibility: hidden;
}
.inspector-resizer {
  position: relative;
  z-index: 3;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
}
.inspector-resizer::after {
  content: "";
  position: absolute;
  inset: 0 -4px;
}
.inspector-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: transparent;
  transition: background 0.12s;
}
.inspector-resizer:hover::before,
.inspector-resizer.dragging::before,
.inspector-resizer:focus-visible::before {
  background: var(--ring, var(--muted-foreground));
}
.canvas-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--border);
}
#canvas {
  position: absolute;
  inset: 0;
  background-color: var(--background);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
  background-size: 18px 18px;
}
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.manual-add {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.manual-add .field-label {
  display: block;
  margin-bottom: 10px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px dashed var(--border);
  background: var(--background);
  font-size: 12px;
  font-weight: 500;
  cursor: grab;
}
.palette-item:hover {
  background: var(--muted);
}
.palette-item[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.canvas-tools {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  gap: 4px;
  background: var(--popover);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--menu-shadow);
  padding: 4px;
}
.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--muted-foreground);
  text-align: center;
}

.inspector {
  overflow-y: auto;
  background: var(--background);
  min-height: 0;
  flex: 1;
}

/* ── Side panel: Chat / Manual ─────────────────────────────────────────── */
.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--background);
}
.side-tabs {
  display: flex;
  gap: 2px;
  height: 32px;
  margin: 10px 16px 0;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--muted);
  flex: none;
}
.side-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.side-tab:hover {
  color: var(--foreground);
}
.side-tab[aria-selected="true"] {
  background: var(--background);
  color: var(--foreground);
  box-shadow:
    var(--surface-shadow),
    0 0 0 1px var(--border);
}
.side-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring-soft);
}
.chat-panel {
  flex: 1;
  min-height: 0;
  display: flex;
}
.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-log:has(> .chat-empty) {
  justify-content: center;
}
/* The editor's agent-zero panel: a head with Undo and New conversation, the conversation, then the editor's own notes. */
.agent-panel-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 16px 0;
  min-height: 32px;
}
.agent-panel-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.agent-panel-name .icon {
  width: 14px;
  height: 14px;
}
.agent-panel-head .spacer {
  flex: 1;
}
.agent-panel .thread-messages {
  padding: 4px 0;
}
.agent-panel .user-message-text {
  max-width: 92%;
}
.panel-notes {
  flex: none;
  max-height: 30vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 20px 10px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
}
.panel-notes[hidden] {
  display: none;
}
.panel-chips {
  flex: none;
  margin: 0 16px 8px;
}
.panel-chips[hidden] {
  display: none;
}
.panel-error {
  flex: none;
  margin: 0 16px 6px;
  font-size: 12px;
  color: var(--destructive-text);
}
.panel-error:empty {
  display: none;
}
.chat-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: 384px;
  margin: 0 auto;
  text-align: center;
}
.chat-empty-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}
.chat-empty .hint {
  font-size: 14px;
  line-height: 20px;
}
.chat-empty .hint {
  margin: 0;
}
.chat-msg {
  display: grid;
  gap: 6px;
  max-width: 92%;
}
.chat-msg[data-role="user"] {
  align-self: flex-end;
}
.chat-msg[data-role="assistant"] {
  align-self: flex-start;
}
.chat-bubble {
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-msg[data-role="user"] .chat-bubble {
  background: var(--muted);
  color: var(--foreground);
}
.chat-msg[data-role="assistant"]:not([data-tone]) .chat-bubble {
  background: none;
  padding: 0 2px;
}
/* An assistant answer renders Markdown: the block structure handles wrapping, so the bubble drops pre-wrap and the edge margins collapse. */
.chat-msg[data-role="assistant"] .chat-bubble:has(> .markdown) {
  white-space: normal;
}
.chat-bubble > .markdown > :first-child {
  margin-top: 0;
}
.chat-bubble > .markdown > :last-child {
  margin-bottom: 0;
}
.chat-msg[data-tone="danger"] .chat-bubble {
  background: var(--destructive-soft);
  color: var(--destructive-text);
}
.chat-msg[data-tone="note"] .chat-bubble {
  background: transparent;
  color: var(--muted-foreground);
  padding: 0 2px;
}
.chat-changes {
  display: grid;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--hairline);
  font-size: 12px;
}
.chat-changes ul {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 2px;
}
.chat-changes > .btn {
  justify-self: start;
}
.chat-changes[data-undone="true"] ul {
  text-decoration: line-through;
  color: var(--muted-foreground);
}
.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-button:hover {
  text-decoration-color: currentColor;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chat-suggestion {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.chat-suggestion:hover {
  background: var(--muted);
}
.chat-suggestion:disabled {
  opacity: 0.5;
  cursor: default;
}
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.chat-action-done {
  font-size: 12px;
  color: var(--muted-foreground);
}
.chat-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 20px 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--destructive-soft);
  font-size: 13px;
  flex: none;
}
.chat-alert .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}
.chat-alert-title {
  font-weight: 500;
  color: var(--destructive-text);
  overflow-wrap: anywhere;
}
.chat-alert p {
  margin: 0;
  overflow-wrap: anywhere;
}
.chat-suggestion[data-kind="action"] {
  border-color: var(--accent-brand);
  color: var(--accent-text);
  font-weight: 500;
}
.side-tab[data-attention="true"]::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--destructive);
}
.chat-build {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 20px 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 13px;
  flex: none;
}
.chat-build .grow {
  flex: 1;
  min-width: 0;
}
.chat-build p {
  margin: 2px 0 0;
}
.chat-cards {
  flex: none;
  display: grid;
  gap: 0;
  max-height: 45vh;
  overflow-y: auto;
}
.chat-cards:empty {
  display: none;
}
.chat-brief {
  margin: 0 20px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 13px;
}
.chat-brief > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}
.chat-brief > summary::-webkit-details-marker {
  display: none;
}
.chat-brief .grow {
  flex: 1;
}
.chat-brief .brief-body {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px;
}
.chat-brief .brief-goal {
  margin: 0;
}
.chat-brief .field-label {
  margin-top: 4px;
}
.brief-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 2px;
}
.brief-list .brief-list {
  margin-top: 2px;
  color: var(--muted-foreground);
}
.brief-decisions {
  display: grid;
  gap: 8px;
}
.brief-decision {
  display: grid;
  gap: 2px;
  font-size: 13px;
}
.brief-decision[data-open="true"] .input {
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.brief-case {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px 12px;
  display: grid;
  gap: 8px;
}
.build-log {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 1px;
  font-size: 12px;
}
.build-log li[data-minor="true"] {
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The editor's composer: the same card as Chat, send button inside. */
.side-panel .chat-composer {
  position: relative;
  flex: none;
  display: block;
  margin: 0 16px 12px;
  padding: 0 0 36px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--card);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.side-panel .chat-composer:focus-within {
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 20%, transparent);
}
textarea.input.chat-input {
  resize: none;
  min-height: 28px;
  max-height: 240px;
  padding: 8px 12px 0;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  box-shadow: none;
  field-sizing: content;
}
textarea.input.chat-input:focus-visible {
  box-shadow: none;
}
.side-panel .chat-composer > .row {
  position: absolute;
  left: 12px;
  right: 6px;
  bottom: 4px;
}
.side-panel .chat-composer .chat-send {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
}
.drawflow .drawflow-node[data-ai-changed="true"] {
  box-shadow:
    0 0 0 2px var(--accent-brand),
    0 0 0 6px var(--accent-soft);
  transition: box-shadow 0.3s;
}
.inspector-inner {
  padding: 20px;
  display: grid;
  gap: 14px;
}
.inspector h3 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.chip {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.chip:hover {
  background: var(--muted);
}
.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
/* Two rules with nothing between them draw an empty section: show one. */
.divider + .divider {
  display: none;
}

.runs {
  grid-row: 3;
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  background: var(--background);
  height: var(--runs-h, 260px);
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 0;
}
.runs[data-collapsed="true"] {
  height: 40px;
}
.runs-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.runs-head {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--background);
}
.run-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 16px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}
.run-item:hover {
  background: var(--muted);
}
.run-item[aria-current="true"] {
  background: var(--muted);
}
.run-item .when {
  flex: 1;
  color: var(--muted-foreground);
}
/* Rows keep their natural height (max-content): the steps' cards clip their
   content, which would otherwise let the grid squeeze them into the pane's
   fixed height instead of scrolling. */
.run-detail {
  overflow-y: auto;
  padding: 12px 16px;
  display: grid;
  grid-auto-rows: max-content;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
.node-result {
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--hairline);
  overflow: hidden;
}
.node-result summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}
.node-result summary::-webkit-details-marker {
  display: none;
}
.node-result > .retry-row,
.node-result > .reused-from {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.run-lineage {
  margin: 0;
}
.node-result pre {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 50%, transparent);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

/* Schedule popover */
.popover {
  position: absolute;
  top: 4px;
  right: 16px;
  z-index: 30;
  width: min(320px, calc(100% - 32px));
  overflow: hidden;
  background: var(--popover);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--menu-shadow);
}
.popover h3 {
  margin: 0;
  font-size: 16px !important;
  line-height: 24px;
  font-weight: 500;
}
/* The publish review hangs from the editor header, however tall the header wraps. */
.main[data-workspace-editor] > .topbar + div {
  position: relative;
  z-index: 30;
}

/* ── Drawflow overrides ────────────────────────────────────────────────── */
.drawflow .drawflow-node {
  background: var(--card);
  color: var(--foreground);
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--hairline);
  width: 220px;
  min-height: 0;
  padding: 0;
}
.drawflow .drawflow-node:hover {
  box-shadow: 0 0 0 1px var(--ring);
}
.drawflow .drawflow-node.selected {
  background: var(--card);
  box-shadow: 0 0 0 2px var(--accent-brand);
}
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--muted-foreground);
}
.drawflow .drawflow-node .input:hover,
.drawflow .drawflow-node .output:hover {
  background: var(--accent-brand);
}
/* Drawflow positions every svg absolutely (for connections); not our icons. */
.drawflow .wf-node svg {
  position: static;
}
.drawflow .drawflow-node .inputs {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
}
.drawflow .drawflow-node .outputs {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  width: auto;
}
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
  left: auto;
  right: auto;
  top: auto;
  margin: 0;
}
/* A condition's outputs are its branches; each carries the branch name. */
.drawflow .drawflow-node .output[data-branch] {
  position: relative;
}
.drawflow .drawflow-node .output[data-branch]::after {
  content: attr(data-branch);
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  color: var(--muted-foreground);
  background: var(--background);
  padding: 2px 4px;
  border-radius: 4px;
  pointer-events: none;
}
.drawflow .drawflow-node .output[data-taken] {
  background: var(--ok);
}
.drawflow .drawflow-node .output[data-taken]::after {
  color: var(--foreground);
  font-weight: 600;
}
.drawflow .drawflow-node .drawflow_content_node {
  width: 100%;
}
.drawflow .connection .main-path {
  stroke: var(--muted-foreground);
  stroke-width: 2px;
}
.drawflow .connection .main-path:hover,
.drawflow .connection .main-path.selected {
  stroke: var(--accent-brand);
}
.drawflow-delete {
  background: var(--primary);
  color: var(--primary-foreground);
  border: 0;
  width: 22px;
  height: 22px;
  line-height: 22px;
  font-size: 13px;
  font-family: var(--font-sans);
  box-shadow: none;
}
.parent-node .drawflow-delete {
  right: -11px;
  top: -11px;
}

.wf-node {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}
.wf-node-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
.wf-node-head .title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-node-head .badge {
  flex-shrink: 0;
}
.wf-node-sub {
  font-size: 11px;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* A step the AI still has to fill in (a skeleton node). */
.drawflow .drawflow-node:has(.wf-node[data-pending="true"]) {
  box-shadow: 0 0 0 1px var(--accent-brand);
  background: color-mix(in oklch, var(--accent-soft) 40%, var(--card));
}

/* ── AI build ─────────────────────────────────────────────────── */
.canvas-empty-card {
  pointer-events: auto;
  width: min(440px, 82%);
  display: grid;
  gap: 10px;
  text-align: left;
  background: var(--card);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--surface-shadow);
  padding: 16px;
}
.canvas-empty-card .canvas-empty-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--foreground);
  margin: 0;
}
.build-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
  font-size: 13px;
}
.build-bar[data-tone="warn"] {
  margin: 8px 16px 0;
  padding: 6px 6px 6px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--destructive-soft);
  color: var(--destructive-text);
  font-size: 12px;
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--destructive) 20%, transparent);
  flex-wrap: wrap;
}
.build-bar[data-tone="warn"] .build-bar-label {
  font-weight: 500;
}
.build-bar .spacer {
  flex: 1;
}
.build-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.build-bar-problem {
  color: var(--destructive-text);
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawflow-node[data-state="succeeded"] {
  box-shadow: 0 0 0 1px var(--ok);
}
.drawflow-node[data-state="failed"] {
  box-shadow: 0 0 0 1px var(--destructive);
}
.drawflow-node[data-state="running"] {
  box-shadow: 0 0 0 2px var(--accent-brand);
}
.drawflow-node[data-state="skipped"],
.drawflow-node[data-state="canceled"] {
  opacity: 0.6;
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .editor {
    grid-template-columns: 1fr;
    grid-template-rows: 55vh auto auto;
  }
  .inspector-resizer,
  .runs-resizer {
    display: none;
  }
  .editor > .canvas-wrap,
  .editor > .side-panel,
  .runs {
    grid-row: auto;
  }
  .chat-log {
    max-height: 60vh;
  }
  .canvas-wrap {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .runs {
    grid-template-columns: 1fr;
    height: auto;
  }
  .content {
    padding: 24px 16px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 16px;
  }
}

/* Version history, publish review, contract evidence */
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.history ul,
.changes {
  margin: 4px 0 0;
  padding-left: 18px;
  font-size: 12px;
  display: grid;
  gap: 2px;
}
.changes {
  font-size: 13px;
}
.contract-log {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.code-details > * + * {
  margin-top: 12px;
}
.code-details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 0;
}
.code-sample {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Settings ─────────────────────────────────────────────────────────────
   One calm, wide layout for every Settings page (settings-ui.js): the Settings
   menu (180px) right next to the app sidebar, the page beside it in a 1180px
   container. Light theme: white page, #18181B text, #52525B muted, #E4E4E7
   lines; dark keeps the theme tokens. */
.page:has(> .settings-layout) {
  --background: #fff;
  background: var(--background);
}
:root[data-theme="dark"] .page:has(> .settings-layout) {
  --background: oklch(0.18 0.005 285.823);
}
.settings-layout {
  --foreground: #18181b;
  --muted-foreground: #52525b;
  --border: #e4e4e7;
  --surface-border: #e4e4e7;
  --input: #e4e4e7;
  --ok: #16a34a;
  --ok-text: #15803d;
  --destructive: #dc2626;
  --destructive-text: #b91c1c;
  display: flex;
  align-items: flex-start;
  gap: 40px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 40px 96px;
  color: var(--foreground);
}
:root[data-theme="dark"] .settings-layout {
  --foreground: oklch(0.985 0 0);
  --muted-foreground: oklch(0.715 0.015 286.067);
  --border: oklch(1 0 0 / 8%);
  --surface-border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ok: oklch(0.72 0.14 155);
  --ok-text: oklch(0.76 0.13 155);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-text: oklch(0.74 0.17 22.216);
}
.settings {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 28px;
  padding: 0;
  margin: 0;
  max-width: none;
}
.settings > [role="status"]:empty {
  display: none;
}
.settings .input {
  border-radius: 10px;
}
.settings .input:not(textarea) {
  height: 36px;
}
.settings .btn {
  border-radius: 8px;
}
.settings .btn[data-size="sm"],
.settings .btn[data-size="icon"] {
  border-radius: 8px;
}
/* The Settings menu: four groups, sticky beside the page. */
.settings-nav {
  position: sticky;
  top: 0;
  flex: none;
  width: 180px;
  display: grid;
  gap: 20px;
}
.settings-nav-group {
  display: grid;
  gap: 2px;
}
.settings-nav-label {
  padding: 0 10px 4px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.settings-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted-foreground);
  font-size: 14px;
  white-space: nowrap;
}
.settings-nav a:hover {
  text-decoration: none;
  background: var(--muted);
  color: var(--foreground);
}
.settings-nav a[aria-current="page"] {
  background: var(--surface-selected);
  color: var(--foreground);
  font-weight: 500;
}
.settings-nav a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
/* The page header: a 24px title and one line. */
.settings-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.settings-page-head .grow {
  min-width: 0;
  flex: 1 1 320px;
}
.settings-page-head h2 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.settings-page-head .hint {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 20px;
}
.settings-page-head > .btn,
.settings-page-head > .row {
  flex: none;
  margin-top: 2px;
}
/* Underline tabs for a page with many groups. */
.settings-tabs {
  display: flex;
  gap: 4px;
  margin: -8px 0 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs a {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 4px;
  margin-bottom: -1px;
  margin-right: 16px;
  border-bottom: 2px solid transparent;
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.settings-tabs a:hover {
  text-decoration: none;
  color: var(--foreground);
}
.settings-tabs a[aria-current="page"] {
  color: var(--foreground);
  border-bottom-color: var(--foreground);
}
.settings-tabs a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
  border-radius: 4px;
}
/* Groups of rows: a 1px line between groups, never a box. */
.settings-group {
  display: grid;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
}
.settings > .settings-group:first-child,
:is(.settings-page-head, .settings-tabs, .notice, [role="status"]:empty, .error-text:empty) + .settings-group,
:is(.settings-page-head, .settings-tabs, .notice, [role="status"]:empty, .error-text:empty)
  + :not(.settings-group)
  > .settings-group:first-child {
  border-top: 0;
  padding-top: 4px;
}
.settings-group-head {
  display: grid;
  gap: 2px;
}
.settings-group-head h3 {
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  margin: 0;
}
.settings-group-head .hint {
  margin: 0;
}
/* One setting: title and one line left, the control right; the columns wrap when narrow. */
.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 48px;
  min-width: 0;
}
.settings-row-copy {
  flex: 1 1 240px;
  min-width: 240px;
  display: grid;
  gap: 4px;
}
.settings-row-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  line-height: 22px;
  font-weight: 600;
}
.settings-row-desc {
  font-size: 13px;
  line-height: 18px;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-row-more {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted-foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.settings-row-info {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted-foreground);
  cursor: help;
}
.settings-row-info .icon {
  width: 14px;
  height: 14px;
}
.settings-row-control {
  flex: 2 1 440px;
  min-width: 440px;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 36px;
}
.settings-row-control > .row {
  flex-wrap: wrap;
}
.settings-row-control > .btn,
.settings-row-control > .switch,
.settings-row-control > .switch-field {
  justify-self: start;
}
.settings-row-control > .row > .input {
  flex: 1 1 200px;
  width: auto;
}
.settings-row-control .input {
  max-width: 560px;
}
.settings-row-control textarea.input {
  max-width: none;
}
.settings-row-control .settings-value {
  font-size: 14px;
  line-height: 20px;
  padding-top: 7px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.settings-row-control .settings-value .mono {
  font-size: 13px;
}
.settings-row-control .hint {
  font-size: 12px;
  line-height: 16px;
}
.control-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}
.control-inline > .control-labelled:first-child {
  flex: 1 1 260px;
}
.control-labelled {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.control-labelled > .input[type="number"] {
  width: 120px;
}
.autosave-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.char-counter {
  justify-self: end;
  font-variant-numeric: tabular-nums;
}
/* Lists of items, the one place with a border: 10px radius, one line between rows. */
.settings-list {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}
.settings-list > .tile-row + .tile-row,
.settings-list > .connector-row + .connector-row,
.settings-list > .tile-row + .settings-form-body,
.settings-list > .settings-form-body + .tile-row {
  border-top: 1px solid var(--border);
}
.tile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-width: 0;
  min-height: 60px;
  background: none;
  border: 0;
  border-radius: 0;
}
.tile-row .grow {
  flex: 1;
  min-width: 0;
}
.tile-row .title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}
.tile-row .hint {
  font-size: 13px;
  line-height: 18px;
}
.tile-row .title .badge {
  margin-left: 6px;
  vertical-align: 1px;
}
.tile-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tile-actions .row {
  gap: 12px;
}
.tile-actions select.input {
  width: auto;
  height: 32px;
}
.tile-row .account-avatar,
.tile-row .connector-mark {
  flex: none;
}
.settings-empty {
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 18px;
  text-align: center;
}
/* Toggle switches. */
.switch {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted-foreground) 35%, transparent);
  cursor: pointer;
  transition: background 0.15s;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.15s;
}
.switch[aria-pressed="true"] {
  background: var(--foreground);
}
.switch[aria-pressed="true"] .switch-knob {
  transform: translateX(16px);
}
:root[data-theme="dark"] .switch[aria-pressed="true"] .switch-knob {
  background: var(--background);
}
.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.switch:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--ring);
}
.switch-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--foreground);
}
.settings-row-control > .switch,
.settings-row-control > .switch-field {
  margin-top: 8px;
}
/* Danger zone: last on a page. */
.settings-danger {
  display: grid;
  gap: 20px;
  padding: 20px 24px;
  margin-top: 4px;
  border: 1px solid color-mix(in oklch, var(--destructive) 35%, transparent);
  border-radius: 10px;
  background: color-mix(in oklch, var(--destructive) 3%, transparent);
}
.settings-danger h3 {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
  color: var(--destructive-text);
}
.btn[data-variant="danger-outline"] {
  background: transparent;
  border-color: color-mix(in oklch, var(--destructive) 55%, transparent);
  color: var(--destructive-text);
}
.btn[data-variant="danger-outline"]:hover:not(:disabled) {
  background: var(--destructive-soft);
  border-color: var(--destructive);
}
/* The sticky save bar: in the page's flow, stuck to the bottom of the scrolling pane while the form is above it. */
.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 16px;
  border-radius: 10px;
  background: var(--card);
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--floating-shadow);
  font-size: 14px;
}
.save-bar[hidden] {
  display: none;
}
.save-bar-text {
  font-weight: 500;
}
/* Advanced: folded technical detail. */
.settings-advanced {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}
.settings-advanced > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 4px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
  border-radius: 6px;
}
.settings-advanced > summary::-webkit-details-marker {
  display: none;
}
.settings-advanced > summary:hover {
  color: var(--foreground);
}
.settings-advanced > summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
.settings-advanced > summary .icon {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}
.settings-advanced[open] > summary .icon {
  transform: rotate(90deg);
}
.settings-advanced-body {
  display: grid;
  gap: 24px;
  padding: 12px 0 8px;
}
/* Stat tiles. */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 220px));
  gap: 12px;
}
.stat-tile {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.stat-label {
  font-size: 12px;
  color: var(--muted-foreground);
}
.stat-value {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.settings .notice {
  font-size: 13px;
  line-height: 18px;
}
.settings .notice a {
  color: inherit;
}
.profile-name .grow {
  display: grid;
  gap: 6px;
}
@media (max-width: 1100px) {
  .settings-layout {
    gap: 28px;
    padding: 24px 24px 96px;
  }
}
@media (max-width: 760px) {
  .settings-layout {
    flex-direction: column;
    gap: 16px;
    padding: 12px 16px 96px;
  }
  .settings-nav {
    position: static;
    width: auto;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -16px;
    padding-inline: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
  }
  .settings-nav-group {
    display: flex;
    gap: 2px;
    flex: none;
  }
  .settings-nav-label {
    display: none;
  }
  .settings-nav a {
    flex: none;
    height: 28px;
    padding: 0 10px;
  }
  .settings {
    gap: 20px;
  }
  .settings-group {
    padding: 20px 0;
    gap: 20px;
  }
  .settings-row-copy,
  .settings-row-control {
    flex-basis: 100%;
    min-width: 0;
  }
  .settings-row-control .input {
    max-width: none;
  }
  .settings-row-desc {
    white-space: normal;
  }
  .tile-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .tile-actions {
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  /* A lone "⋯" or switch stays on the row; wider actions (a select, text buttons) take a line of their own. */
  .tile-actions:has(select, .switch-field, .btn:not([data-size="icon"])) {
    flex-basis: 100%;
    justify-content: flex-start;
    padding-left: 20px;
  }
  .tile-row > :is(.account-avatar, .connector-mark) ~ .tile-actions {
    padding-left: 0;
  }
  .stat-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .save-bar {
    bottom: 8px;
    flex-wrap: wrap;
  }
  .settings-danger {
    padding: 16px;
  }
}
.stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}
/* The older card layout, used by Telemetry (usage.js). */
.settings-section {
  display: grid;
  gap: 8px;
}
.settings-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  row-gap: 8px;
}
.settings-section-head .grow {
  min-width: 0;
}
.settings-section-head > .row {
  flex: none;
}
.settings-section h2 {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}
.settings-section-head .hint {
  margin: 2px 0 0;
}
.settings-section-body {
  display: grid;
  gap: 12px;
}
.settings-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--surface-shadow);
  overflow: hidden;
}
.settings-card > .tile-row + .tile-row {
  border-top: 1px solid var(--border);
}
.settings-card.is-pad {
  padding: 16px;
  display: grid;
  gap: 12px;
}
/* Telemetry (usage.js) */
.usage-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
  flex-wrap: wrap;
}
.usage-row .usage-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.settings-card > .usage-row {
  padding: 12px;
}
.settings-card > .usage-row + .usage-row {
  border-top: 1px solid var(--border);
}
.usage-scroll {
  overflow-x: auto;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--card);
}
.usage-scroll:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.usage-table th {
  min-width: 80px;
  text-align: left;
  font-weight: 400;
  color: var(--muted-foreground);
  font-size: 12px;
  padding: 8px 12px;
}
.usage-table td {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}
.usage-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.usage-table td.truncate {
  max-width: 320px;
}
.content.telemetry {
  max-width: 1152px;
  gap: 32px;
}
/* A section's title keeps its line; a card toggle beside it drops below on a narrow screen. */
.content.telemetry .settings-section-head > .grow {
  flex: 1 1 240px;
}
.telemetry-updated {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.telemetry-toolbar {
  gap: 8px;
}
.telemetry-toolbar .spacer {
  flex: 1 0 8px;
}
.telemetry-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.telemetry-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.telemetry-control select.input {
  width: auto;
  height: 28px;
  font-size: 13px;
  padding-left: 8px;
}
@media (max-width: 700px) {
  .page-tabs.telemetry-toolbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    padding-block: 10px;
    row-gap: 8px;
    mask-image: none;
  }
  .telemetry-toolbar .spacer {
    display: none;
  }
  .telemetry-controls {
    flex: 1 1 100%;
  }
  .telemetry-controls .telemetry-control:first-child {
    flex: 1;
  }
  .telemetry-controls .telemetry-control:first-child select.input {
    flex: 1;
  }
}
/* KPI tiles in one divided card: 4 across, 2 from 900px, 1 on a phone. */
.kpi-row {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
}
.kpi {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 16px;
  min-width: 0;
}
.kpi + .kpi {
  border-left: 1px solid var(--border);
}
.kpi-label {
  font-size: 12px;
  color: var(--muted-foreground);
}
.kpi-value {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-hint {
  font-size: 12px;
  color: var(--muted-foreground);
}
@media (max-width: 900px) {
  .kpi-row {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi + .kpi {
    border-left: 0;
  }
  .kpi:nth-child(even) {
    border-left: 1px solid var(--border);
  }
  .kpi:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}
@media (max-width: 520px) {
  .kpi-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpi:nth-child(even) {
    border-left: 0;
  }
  .kpi + .kpi {
    border-top: 1px solid var(--border);
  }
  .telemetry-updated {
    display: none;
  }
}
/* Today against the limits. */
.meters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px 24px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.meter {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  flex-wrap: wrap;
}
.meter-track {
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
}
.meter-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-brand);
}
.meter[data-tone="warn"] .meter-track > span {
  background: var(--warn);
}
.meter[data-tone="danger"] .meter-track > span {
  background: var(--destructive);
}
.meter[data-tone="danger"] .usage-value {
  color: var(--destructive-text);
}
/* A card-local choice (the chart's metric). */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--muted);
}
.segmented .btn {
  height: 24px;
  padding: 0 10px;
  border: 0;
  box-shadow: none;
  background: transparent;
  color: var(--muted-foreground);
  font-weight: 500;
}
.segmented .btn:hover:not(:disabled):not([aria-pressed="true"]) {
  background: transparent;
  color: var(--foreground);
}
.segmented .btn[aria-pressed="true"] {
  background: var(--card);
  color: var(--foreground);
  box-shadow:
    var(--surface-shadow),
    0 0 0 1px var(--surface-border);
}
/* The trend chart: a fixed 3:1 plot; on a phone it scrolls inside its card. */
.chart-card {
  margin: 0;
  padding: 16px;
  display: grid;
  gap: 12px;
}
.chart-plot {
  position: relative;
  aspect-ratio: 3 / 1;
  min-height: 240px;
  min-width: 0;
}
.chart-plot:has(.usage-scroll) {
  aspect-ratio: auto;
  min-height: 0;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}
.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.chart-legend .truncate {
  max-width: 240px;
}
.chart-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}
@media (max-width: 700px) {
  .chart-plot {
    aspect-ratio: auto;
    height: 240px;
  }
}
/* A ranked share: a bar against the leader, then the number. */
.rank-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.rank-bar {
  width: 96px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
}
.rank-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-brand);
}
.rank-value {
  min-width: 36px;
}
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.th-sort:hover {
  color: var(--foreground);
}
.th-sort:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
  border-radius: 4px;
}
.th-sort .icon {
  width: 12px;
  height: 12px;
}
.usage-table th[aria-sort="descending"] {
  color: var(--foreground);
}
.show-all {
  justify-self: start;
}
/* The failure mix: one bar split by kind (2px gaps), its legend, the error lines behind it. */
.mix-bar {
  display: flex;
  gap: 2px;
  height: 12px;
  border-radius: 4px;
  overflow: hidden;
}
.mix-bar > span {
  min-width: 2px;
}
.mix-codes > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  width: max-content;
}
.mix-codes > summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
  border-radius: 4px;
}
.mix-codes[open] > summary {
  margin-bottom: 12px;
}
.mix-codes .usage-table td.truncate {
  max-width: 560px;
}
/* The daily detail, folded away under its section title. */
.daily-detail > summary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.daily-detail > summary::-webkit-details-marker {
  display: none;
}
.daily-detail > summary .grow {
  display: grid;
  gap: 2px;
}
.daily-detail > summary h2 {
  display: inline;
}
.daily-detail > summary .icon {
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  transition: transform 0.15s;
}
.daily-detail[open] > summary .icon {
  transform: rotate(180deg);
}
.daily-detail > summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
  border-radius: 6px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: none;
  background: color-mix(in oklch, var(--muted-foreground) 40%, transparent);
}
.status-dot[data-tone="ok"] {
  background: var(--ok);
}
.status-dot[data-tone="danger"] {
  background: var(--destructive);
}
.status-dot[data-tone="accent"] {
  background: var(--accent-brand);
}
.status-dot[data-tone="warn"] {
  background: var(--warn);
}
@media (prefers-reduced-motion: no-preference) {
  .status-dot[data-live] {
    animation: pulse 1.2s ease-in-out infinite;
  }
}
.notice {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--destructive-soft);
  color: var(--destructive-text);
}

.connector-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  min-height: 60px;
  transition: background 0.15s;
}
.connector-row + .connector-row {
  border-top: 1px solid var(--border);
}
.connector-row > .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.connector-row > .grow .hint {
  font-size: 13px;
  line-height: 18px;
}
.connector-row:has(.connector-name:not(:disabled)):hover {
  background: color-mix(in oklch, var(--muted) 50%, transparent);
}
.connector-mark {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
/* Logos sit on white in both themes: most are drawn for a light background. Nango's artwork carries its own margin. */
.connector-mark.has-logo {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}
.connector-mark .brand-logo svg {
  width: 24px;
  height: 24px;
}
.connector-mark .brand-logo img {
  width: 32px;
  height: 32px;
  border-radius: 0;
}
.connector-mark.is-full {
  background: none;
  box-shadow: none;
}
.connector-mark.is-full .brand-logo img {
  width: 36px;
  height: 36px;
}
.connector-name {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--foreground);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.connector-name:disabled {
  cursor: default;
}
/* The name's button covers the whole line, so a click anywhere opens the app's page; the action button sits above it. */
.connector-name::after {
  content: "";
  position: absolute;
  inset: 0;
}
.connector-name:focus-visible {
  outline: none;
}
.connector-row:has(.connector-name:focus-visible) {
  box-shadow: inset 0 0 0 2px var(--ring);
}
.connector-state {
  position: relative;
  z-index: 1;
  flex: none;
  font-size: 14px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.connector-state[data-tone="ok"] {
  color: var(--ok-text);
}
.connector-state[data-tone="warn"] {
  color: var(--warn-text);
}
.connector-state[data-tone="danger"] {
  color: var(--destructive-text);
}
.connector-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.connector-action > .btn,
.connector-row > .btn {
  position: relative;
  z-index: 1;
}
/* A phone: the name keeps the first line, the state and its button go below it. */
@media (max-width: 560px) {
  .connector-row {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 10px 12px;
  }
  .connector-row > .grow {
    flex-basis: calc(100% - 48px);
  }
  .connector-row > .status-dot {
    margin-left: 48px;
  }
  .connector-state {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.brand-logo {
  display: inline-flex;
}

/* One app's page (connector-detail.js): the guide folds open, the core tools list by group, notes and preferences. */
.connector-detail-back {
  margin-bottom: -16px;
}
.skill-preview {
  border-top: 1px solid var(--border);
  padding-top: 4px;
}
.skill-preview > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 4px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.skill-preview > summary::-webkit-details-marker {
  display: none;
}
.skill-preview > summary .hint {
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
}
.skill-preview > summary .icon {
  width: 14px;
  height: 14px;
  flex: none;
  transition: transform 0.15s;
}
.skill-preview[open] > summary .icon {
  transform: rotate(90deg);
}
.skill-preview-body {
  padding: 8px 4px 4px;
  font-size: 14px;
  max-height: 480px;
  overflow: auto;
}
.core-group + .core-group {
  margin-top: 16px;
}
.core-group-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.skill-notes {
  width: 100%;
  resize: vertical;
}
.skill-notes-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}
.skill-notes-propose {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.skill-notes-propose .input {
  flex: 1;
  min-width: 0;
}
.skill-notes-propose .btn {
  flex: none;
}
.preference-add {
  margin-top: 12px;
}
.preference-add .control-inline {
  flex-wrap: nowrap;
  align-items: center;
}
.preference-add select.input {
  width: auto;
  flex: none;
}
.preference-add input.input {
  flex: 1;
  min-width: 0;
}
@media (max-width: 560px) {
  .preference-add .control-inline {
    flex-wrap: wrap;
  }
}
.brand-logo svg {
  width: 28px;
  height: 28px;
  display: block;
}
.brand-logo img {
  width: 28px;
  height: 28px;
  display: block;
  border-radius: 6px;
  object-fit: contain;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  transition:
    border-color 0.15s,
    background 0.15s;
}
.picker-item:hover {
  border-color: var(--ring);
  background: var(--muted);
}
.picker-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring-soft);
  border-color: var(--ring);
}
.picker-item .brand-logo svg {
  width: 22px;
  height: 22px;
}
.picker-item .brand-logo img {
  width: 22px;
  height: 22px;
}
.picker-group {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted-foreground);
}
.picker-group + .picker-grid {
  margin-bottom: 14px;
}
@media (max-width: 560px) {
  .picker-grid {
    grid-template-columns: 1fr;
  }
}
.modal {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  color: var(--foreground);
  background: var(--popover);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--floating-shadow);
}
.modal::backdrop {
  background: rgb(0 0 0 / 10%);
  backdrop-filter: blur(4px);
}
@media (prefers-reduced-motion: no-preference) {
  .modal[open] {
    animation: modal-in 100ms ease;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
}
.modal .card-head {
  align-items: flex-start;
}
.saved-headers {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (max-width: 900px) {
  .settings {
    padding: 24px 16px 48px;
  }
}
.saved-headers .chips {
  flex: 1;
}
.field > a.hint {
  justify-self: start;
}

/* Run timeline and test dialog */
.trace {
  margin-top: 8px;
}
.trace-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.trace-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.trace-item pre {
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.failure details {
  margin-top: 4px;
}
.test-dialog {
  max-width: 640px;
  display: grid;
  gap: 12px;
}
.test-dialog pre {
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ── Tool permissions (shared by steps and agents) ─────────────────────── */
.row.wrap {
  flex-wrap: wrap;
}
.badge[data-tone="warn"] {
  background: var(--warn-soft);
  color: var(--warn-text);
}
.notice[data-tone="warn"] {
  background: var(--warn-soft);
  color: inherit;
}
.notice[data-tone="info"] {
  background: var(--accent-soft);
  color: inherit;
}
.perm-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.perm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.perm-row[data-missing] {
  border-color: var(--destructive);
  background: var(--destructive-soft);
}
.perm-row > .brand-logo svg {
  width: 22px;
  height: 22px;
}
.perm-row > [aria-hidden] {
  margin-top: 2px;
}
.perm-row .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.perm-row .title {
  font-weight: 500;
  font-size: 13px;
  min-width: 0;
}
.perm-row p {
  margin: 0;
}
.perm-actions {
  flex-wrap: wrap;
}
.perm-actions select.input {
  width: auto;
  max-width: 100%;
  height: 28px;
  font-size: 12px;
}
.wf-node-warn {
  color: var(--destructive-text);
}

.modal.tool-modal {
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
}
.tool-editor {
  display: flex;
  flex-direction: column;
  max-height: min(760px, calc(100vh - 32px));
}
.tool-editor .card-body {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.tool-editor p {
  margin: 0;
}
.tool-list {
  display: grid;
  gap: 14px;
}
.tool-group {
  display: grid;
  gap: 2px;
}
.tool-group h4 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.tool-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.tool-item:hover {
  background: var(--muted);
}
.tool-item:focus-within {
  box-shadow: 0 0 0 2px var(--ring-soft);
}
.tool-item input {
  margin-top: 3px;
  flex: none;
}
.tool-item .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.tool-item[data-unavailable] {
  cursor: default;
  color: var(--muted-foreground);
}
.tool-item[data-unavailable]:hover {
  background: none;
}
.repo-more:empty {
  display: none;
}
.tool-name {
  font-size: 12px;
  word-break: break-all;
}
.tool-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-ack {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  font-size: 13px;
}
.tool-ack input {
  margin-top: 3px;
  flex: none;
}
@media (max-width: 560px) {
  .modal.tool-modal {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    margin: 0;
  }
  .tool-editor {
    max-height: 100dvh;
    height: 100%;
  }
  .perm-row {
    flex-wrap: wrap;
  }
}
/* Narrow inspector: actions drop below the summary. */
.inspector .perm-row {
  flex-wrap: wrap;
}
.inspector .perm-row > .grow {
  flex-basis: calc(100% - 40px);
}
.inspector .perm-row > .perm-actions {
  margin-left: 32px;
}

/* Repository setting (agents and LLM steps) */
.repo-binding {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.repo-binding > .btn {
  justify-self: start;
  height: 32px;
  font-size: 14px;
}
.repo-binding > p {
  margin: 0;
}
.repo-binding .notice p {
  margin: 0 0 6px;
}
.repo-row[data-access="builder"] {
  border-color: color-mix(in oklch, var(--warn) 60%, transparent);
}
.repo-access {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.repo-access legend {
  padding: 0;
  margin-bottom: 4px;
}
.repo-access-option {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
}
.repo-access-option:has(input:checked) {
  border-color: var(--ring);
  background: var(--muted);
}
.repo-access-option input {
  margin-top: 3px;
}
.repo-access-option .grow {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.repo-access-option .title {
  font-weight: 500;
  font-size: 13px;
}
.repo-ops .field-label {
  margin: 4px 0 2px;
}
.repo-ops ul {
  margin: 0;
}
.repo-list {
  display: grid;
  gap: 2px;
  max-height: 40vh;
  overflow: auto;
  min-height: 48px;
}
.repo-confirm {
  max-width: 480px;
}
.wf-node-repo {
  display: flex;
  gap: 4px;
  align-items: center;
}
.wf-node-repo svg {
  width: 12px;
  height: 12px;
  flex: none;
}
.wf-node-repo .badge {
  font-size: 11px;
  padding: 0 5px;
}
.pr-link {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.repo-chooser .card-body {
  align-content: start;
}

/* ── Theme switch (sidebar, sign-in, Settings → Preferences) ───────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.theme-switch {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: start;
  align-self: start;
}
.theme-options {
  justify-self: start;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--muted);
  border-radius: var(--radius);
}
.theme-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.theme-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.theme-option:hover {
  color: var(--foreground);
}
.theme-option:has(input:checked) {
  background: var(--background);
  color: var(--foreground);
  box-shadow:
    var(--surface-shadow),
    0 0 0 1px var(--border);
}
:root[data-theme="dark"] .theme-option:has(input:checked),
:root[data-theme="dark"] .side-tab[aria-selected="true"] {
  background: color-mix(in oklch, var(--input) 30%, transparent);
  box-shadow: inset 0 0 0 1px var(--input);
}
:root[data-theme="dark"] .side-tab:focus-visible,
:root[data-theme="dark"] .theme-option:has(input:focus-visible) {
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--ring);
}
.theme-option:has(input:focus-visible) {
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--ring);
}
.theme-switch[data-compact] .theme-options {
  padding: 2px;
}
.theme-switch[data-compact] .theme-option {
  height: 24px;
  width: 28px;
  padding: 0;
  justify-content: center;
}
.theme-switch[data-compact] .theme-option:has(input:checked) {
  background: var(--background);
  color: var(--foreground);
}
.theme-switch[data-compact] .icon {
  width: 14px;
  height: 14px;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 32px;
  width: 32px;
  padding: 0;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-foreground);
}
.theme-toggle:hover {
  background: var(--sidebar-active);
  color: var(--foreground);
}
.theme-toggle:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--ring);
}
.theme-toggle .icon {
  width: 15px;
  height: 15px;
}
.profile-menu .theme-toggle {
  justify-content: flex-start;
  width: 100%;
  padding: 0 8px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--foreground);
}
.profile-menu .theme-toggle:hover {
  background: var(--muted);
}
.profile-menu .theme-toggle .icon {
  width: 14px;
  height: 14px;
}

.login-foot {
  justify-content: space-between;
  align-items: center;
}

/* ── Condition inspector ───────────────────────────────────────────────── */
.branch-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--hairline);
}
.branch-card > .row .input {
  flex: 1;
}
.branch-card .branch-id {
  width: auto;
  flex: 1;
  font-size: 12px;
}
/* The value on its own line, then operator, comparison and remove. */
.rule-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr) auto;
  gap: 4px;
  align-items: start;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--hairline);
}
.rule-row > :first-child {
  grid-column: 1 / -1;
}
.rule-row textarea.input {
  min-height: 34px;
  resize: vertical;
}
label.check {
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.decision {
  display: grid;
  gap: 4px;
  margin: 6px 0;
}
.decision p {
  margin: 0;
}

/* The workflow's slug in the Workflow panel. */
.wf-slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 3px 8px;
  background: var(--muted);
  border-radius: calc(var(--radius) * 0.6);
  overflow-wrap: anywhere;
}

/* ── Workflows list page ──────────────────────────────────────────────────── */
.wf-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 48px;
  padding: 8px 16px;
}
.wf-toolbar .wf-search {
  max-width: 260px;
}
.wf-toolbar .wf-sort {
  width: auto;
}
.wf-toolbar .spacer {
  flex: 1;
}
/* List filters (Workflows, Memory): the same quiet, tab-like item as .page-tabs. */
.wf-filters,
.memory-filters {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.wf-filters .btn,
.memory-filters .btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted-foreground);
}
.wf-filters .btn[aria-pressed="true"],
.memory-filters .btn[aria-pressed="true"] {
  background: var(--surface-selected);
  color: var(--foreground);
}
.wf-table {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) minmax(150px, 1.3fr) minmax(200px, 1.5fr) minmax(120px, 1fr) minmax(
      110px,
      auto
    );
}
.wf-table .wf-head,
.wf-table .wf-row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
}
.wf-table .wf-row {
  color: inherit;
  text-decoration: none;
}
.wf-table .wf-row:hover {
  background: color-mix(in oklch, var(--accent) 40%, transparent);
  text-decoration: none;
}
.wf-table .wf-row:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}
.wf-table .wf-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.wf-table .wf-head .wf-cell {
  min-height: 36px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-foreground);
  padding-top: 0;
  padding-bottom: 0;
}
.wf-table .wf-cell[data-col="name"] {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}
.wf-table .wf-cell[data-col="name"] .title {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.wf-table .wf-cell[data-col="name"] .mono {
  font-size: 12px;
  color: var(--muted-foreground);
}
.wf-table .wf-cell[data-col="trigger"],
.wf-table .wf-cell[data-col="next"] {
  color: var(--muted-foreground);
  font-size: 13px;
}
.wf-table .wf-cell[data-col="run"] .hint {
  font-size: 13px;
}
.wf-table .wf-cell .badge {
  flex: none;
}
.wf-table .wf-cell[data-col="run"] {
  flex-wrap: wrap;
  row-gap: 4px;
}
.wf-table .wf-cell[data-col="run"] .hint {
  white-space: nowrap;
}
.wf-table .wf-empty {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
}
@media (max-width: 900px) {
  .wf-table {
    grid-template-columns: minmax(0, 2fr) minmax(150px, 1.3fr) auto;
  }
  .wf-table .wf-head {
    display: none;
  }
  .wf-table .wf-cell[data-col="trigger"],
  .wf-table .wf-cell[data-col="next"] {
    display: none;
  }
  .wf-table .wf-row:first-of-type .wf-cell {
    border-top: 0;
  }
}
/* Phones: each workflow is a card — title and status on top, latest run and trigger below. */
@media (max-width: 700px) {
  .wf-toolbar {
    padding: 12px 16px;
  }
  .wf-toolbar .wf-search {
    max-width: none;
    flex: 1 1 100%;
  }
  .wf-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
  }
  .wf-toolbar .spacer {
    display: none;
  }
  .wf-table {
    display: block;
  }
  .wf-table .wf-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name status" "run run" "trigger trigger";
    gap: 6px 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
  }
  .wf-table .wf-row .wf-cell {
    padding: 0;
    border-top: 0;
  }
  .wf-table .wf-cell[data-col="name"] {
    grid-area: name;
  }
  .wf-table .wf-cell[data-col="status"] {
    grid-area: status;
    align-self: start;
  }
  .wf-table .wf-cell[data-col="run"] {
    grid-area: run;
  }
  .wf-table .wf-cell[data-col="trigger"] {
    grid-area: trigger;
    display: flex;
    font-size: 12px;
  }
  .wf-table .wf-cell[data-col="name"] .title {
    overflow-wrap: break-word;
  }
}

/* The list itself runs edge to edge in the canvas, as Multica's lists do. */
.content.wf-collection {
  max-width: none;
  padding: 0;
  gap: 0;
}
.wf-card {
  min-width: 0;
}
.wf-card .wf-table .wf-head .wf-cell {
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 1;
}

/* "New workflow" dialog: a segmented tab row (Start / Examples) over the choices. */
.new-wf-tabs {
  margin: 0;
}
.new-wf-choices {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.new-wf-choices > .hint {
  margin: 0 0 2px;
}
.new-wf-choice,
.new-wf-choice[data-variant] {
  height: auto;
  padding: 10px 12px;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
}
.new-wf-choice:hover:not(:disabled),
.new-wf-choice[data-variant]:hover:not(:disabled) {
  border-color: color-mix(in oklch, var(--accent-brand) 40%, transparent);
  background: var(--accent);
}
.new-wf-choice[data-kind="ai"] .icon {
  color: var(--accent-brand);
}
.new-wf-choice .grow {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.new-wf-choice .hint {
  font-weight: 400;
}
/* Standard workflow wizard (template-wizard.js): sources as radio rows with a hint each. */
.template-source {
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.template-source:has(input:checked) {
  border-color: color-mix(in oklch, var(--accent-brand) 50%, transparent);
  background: var(--accent);
}
.template-source input {
  margin-top: 3px;
}
.template-source .grow {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.template-wizard label.check {
  align-items: flex-start;
}

/* What an import (or a duplicate) left to check */
.import-problem-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.import-problem-list li {
  display: flex;
  gap: 8px;
  align-items: baseline;
  line-height: 1.45;
}
.import-problem-list .badge {
  flex: none;
}

/* Company knowledge, source evidence and shared agent conversations. */
.memory-scope {
  padding: 0;
  border: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.memory-scope h3 {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  margin: 0;
}
.memory-scope h4 {
  margin: 8px 0 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.memory-scope label {
  padding-block: 4px;
}
/* What a step reads from Company knowledge: mark, name and ×, on one line (steps and the consent page). */
.memory-scope .perm-row {
  flex-wrap: nowrap;
  align-items: center;
  padding: 6px 6px 6px 10px;
}
.memory-scope .perm-row > .grow {
  flex-basis: auto;
}
.memory-scope .perm-row > [aria-hidden] {
  margin-top: 0;
  flex: none;
}
.memory-scope .perm-row > .btn {
  flex: none;
}
.memory-scope .perm-list > p {
  margin: 0;
}
.memory-scope .perm-row .connector-mark {
  width: 22px;
  height: 22px;
  font-size: 12px;
  border-radius: 6px;
}
.memory-scope .perm-row .connector-mark .brand-logo svg {
  width: 16px;
  height: 16px;
}
.memory-scope .perm-row .connector-mark .brand-logo img {
  width: 20px;
  height: 20px;
}
.memory-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.memory-content pre,
.memory-sources pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
}
.memory-sources {
  margin-block: 12px;
  font-size: 13px;
}
.memory-sources details {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.markdown {
  overflow-wrap: anywhere;
}
.markdown p {
  white-space: pre-wrap;
}
.memory-pdf {
  width: 100%;
  min-height: 480px;
  border: 0;
}
@media (max-width: 700px) {
  .memory-diff {
    grid-template-columns: 1fr;
  }
}

.memory-citation {
  color: var(--primary, #2563eb);
  border: 0;
  background: transparent;
  padding: 0 2px;
  cursor: pointer;
  font: inherit;
}
.memory-content p {
  margin-block: 0;
}
.memory-content .card-body {
  padding: 16px;
}
.memory-content .card-body h3 {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}
.memory-diff h4 {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--muted-foreground);
}
.memory-diff pre {
  margin: 0;
  border-radius: 6px;
  border-left-width: 2px;
}
.memory-content > .btn {
  justify-self: start;
}
.memory-content .memory-sources:empty,
.memory-content .error-text:empty {
  display: none;
}

/* ── Shared page rhythm ──────────────────────────────────────────────────
   Headings use the body face; labels are sentence case (no uppercase
   eyebrows); sizes follow Multica's ladder: 12 caption, 13 label, 14 body,
   16 title-sm, 18 title. */
h1,
h2,
h3,
h4,
h5,
h6,
.brand-name {
  font-family: var(--font-heading);
  color: var(--heading);
}
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
}

/* ── Chat: conversation list | resize handle | conversation ────────────── */
.agent-chat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
}
.search-field {
  display: flex;
  align-items: center;
  position: relative;
}
.search-field > span {
  position: absolute;
  left: 10px;
  color: var(--muted-foreground);
}
.search-field .input {
  padding-left: 32px;
}
.welcome-avatar {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
  color: var(--muted-foreground);
  box-shadow: inset 0 0 0 1px var(--border);
}
.conversation-empty {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 16px;
  padding: 6px 8px;
  margin: 0;
}
.history-older {
  margin: 2px 8px 8px;
  justify-content: flex-start;
  color: var(--muted-foreground);
}
/* Chat's history: a popover under the header's History button; a full-screen list under 800 px. */
.chat-history-anchor {
  position: relative;
  flex: none;
}
.chat-history.popover {
  top: calc(100% + 6px);
  right: 0;
  width: 360px;
  max-height: min(560px, calc(100vh - 96px));
  display: flex;
  flex-direction: column;
}
.chat-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 4px 14px;
  font-size: 14px;
}
.chat-history-close {
  display: none;
}
.chat-history-search {
  padding: 4px 8px;
}
.chat-history-search > span {
  left: 18px;
}
.chat-history-search .input {
  height: 32px;
  font-size: 14px;
}
/* Seven 36 px rows (2 px apart, under 4 px of padding) at most; more scroll, the load-more button at the end. */
.chat-history-scroll {
  max-height: calc(4px + 7 * (36px + 2px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
}
.chat-history-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 6px;
}
.chat-history-row:hover,
.chat-history-row:focus-within {
  background: color-mix(in oklch, var(--accent) 50%, transparent);
}
.chat-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0 8px;
  color: var(--foreground);
  border-radius: 6px;
}
.chat-history-item:hover {
  text-decoration: none;
}
.chat-history-item[aria-current] {
  background: var(--accent);
}
.chat-history-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--ring);
}
.chat-history-item .project-dot[data-empty] {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
}
.chat-history-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  line-height: 20px;
}
.chat-history-item time {
  flex: none;
  font-size: 11px;
  line-height: 15px;
  color: var(--muted-foreground);
}
.chat-history-delete {
  flex: none;
  color: var(--muted-foreground);
  opacity: 0;
}
.chat-history-row:hover .chat-history-delete,
.chat-history-delete:focus-visible {
  opacity: 1;
}
.chat-history-delete:hover {
  color: var(--destructive-text);
}
.thread-header .chat-new,
.thread-header .chat-history-toggle {
  color: var(--muted-foreground);
}
@media (max-width: 800px) {
  .chat-history.popover {
    position: fixed;
    inset: 0;
    width: auto;
    max-height: none;
    border-radius: 0;
    z-index: 70;
  }
  .chat-history-head {
    min-height: 48px;
    padding: 0 8px 0 16px;
    border-bottom: 1px solid var(--border);
  }
  .chat-history-close {
    display: inline-flex;
  }
  .chat-history-scroll {
    flex: 0 1 auto;
    max-height: none;
  }
  .chat-history-list {
    padding-bottom: 8px;
  }
  .chat-history-delete {
    opacity: 1;
  }
  .thread-header .btn .label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
.chat-stage {
  --chat-gutter: 20px;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
@container (min-width: 672px) {
  .agent-transcript,
  .composer-wrap {
    --chat-gutter: 32px;
  }
}
@container (min-width: 896px) {
  .agent-transcript,
  .composer-wrap {
    --chat-gutter: 48px;
  }
}
.thread-header {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
/* Right-click menus. */
.context-menu {
  position: fixed;
  z-index: 60;
  min-width: 190px;
  padding: 4px;
  background: var(--popover);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px var(--surface-border),
    var(--menu-shadow);
}
.context-menu [role="menuitem"] {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--foreground);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.context-menu [role="menuitem"]:hover,
.context-menu [role="menuitem"]:focus-visible {
  background: var(--muted);
  outline: none;
}
.context-menu [role="menuitem"][data-tone="danger"] {
  color: var(--destructive-text);
}
.context-menu .icon {
  width: 14px;
  height: 14px;
}
.thread-heading {
  display: grid;
  flex: 1;
  min-width: 0;
}
.thread-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0 var(--chat-gutter);
}
.agent-transcript:focus-visible {
  outline-offset: -2px;
}
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  align-items: center;
  gap: 20px;
  padding: 32px 0;
  text-align: center;
}
.welcome-avatar {
  width: 56px;
  height: 56px;
}
.welcome-avatar .icon {
  width: 24px;
  height: 24px;
}
.welcome-copy {
  display: grid;
  gap: 4px;
  max-width: 384px;
}
.welcome-copy h2 {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.welcome-copy p {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted-foreground);
}
.chat-starters {
  display: grid;
  gap: 8px;
  width: min(384px, 100%);
}
.chat-starter {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.chat-starter:hover {
  border-color: color-mix(in oklch, var(--accent-brand) 40%, transparent);
  background: var(--accent);
}
.chat-starter:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring-soft);
  border-color: var(--ring);
}
.composer-wrap {
  width: 100%;
  padding: 0 var(--chat-gutter) 12px;
}
.composer-wrap > * {
  max-width: 896px;
  margin-inline: auto;
}
.composer-wrap .error-text {
  margin-block: 0 6px;
}
.composer-wrap .error-text:empty {
  display: none;
}
.composer-wrap .agent-composer {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 64px;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--card);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.composer-wrap .agent-composer:focus-within {
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--ring) 20%, transparent);
}
.chat-prompt {
  width: 100%;
  display: block;
  padding: 8px 12px 0;
  min-height: 28px;
  max-height: 240px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  line-height: 20px;
  font-size: 14px;
}
.chat-prompt::placeholder {
  color: var(--muted-foreground);
}
.chat-prompt:disabled {
  cursor: not-allowed;
}
.chat-prompt:focus-visible {
  outline: none;
}
.composer-wrap .composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 6px;
}
.chat-project-picker {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 4px;
  height: 28px;
  padding: 0 6px 0 8px;
  border-radius: 999px;
  color: var(--muted-foreground);
}
.chat-project-picker:hover {
  background: var(--muted);
  color: var(--foreground);
}
.chat-project-picker .icon {
  width: 14px;
  height: 14px;
}
.chat-project-select {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 13px;
  max-width: 200px;
  min-width: 0;
  padding: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-project-select:disabled {
  opacity: 1;
  appearance: none;
  cursor: default;
}
.composer-wrap .chat-send {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
}
.thread-messages {
  width: 100%;
  max-width: 896px;
  margin: 0 auto;
  padding: 16px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.chat-turn {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.chat-message,
.message-body {
  min-width: 0;
}
.markdown pre {
  max-width: 100%;
}
.user-message {
  display: grid;
  justify-items: end;
  gap: 4px;
}
.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted-foreground);
}
.message-meta strong {
  font-weight: 500;
}
.message-meta time {
  font-size: 11px;
}
.user-message-text {
  max-width: 80%;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--muted);
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-body,
.turn-status {
  font-size: 15px;
  line-height: 1.6;
}
.turn-status {
  margin: 0;
  color: var(--muted-foreground);
}
.markdown p {
  margin: 0 0 8px;
}
.markdown h2 {
  margin: 24px 0 8px;
  font-size: 18px;
  line-height: 26px;
  font-weight: 600;
}
.markdown h3,
.markdown h4,
.markdown h5 {
  margin: 16px 0 8px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}
.markdown > :first-child {
  margin-top: 0;
}
.markdown ul,
.markdown ol {
  padding-left: 24px;
  margin: 0 0 8px;
}
.markdown li {
  margin-bottom: 4px;
}
.markdown pre {
  padding: 12px;
  background: var(--muted);
  border-radius: 8px;
  overflow-x: auto;
}
.markdown :not(pre) > code {
  background: var(--muted);
  padding: 2px 4px;
  border-radius: 4px;
}
.markdown-table {
  margin: 0 0 12px;
  max-width: 100%;
  overflow-x: auto;
}
.markdown table {
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
}
.markdown th,
.markdown td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.markdown th {
  font-weight: 600;
  background: var(--muted);
}
.markdown hr {
  margin: 16px 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.markdown blockquote {
  margin: 0 0 12px;
  padding: 2px 12px;
  border-left: 3px solid var(--border);
  color: var(--muted-foreground);
}
.markdown blockquote p:last-child {
  margin-bottom: 0;
}
.memory-citation {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-brand-ink);
}
.answer-sources {
  margin-top: 12px;
}
.answer-sources > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted-foreground);
  list-style: none;
}
.answer-sources > summary::-webkit-details-marker {
  display: none;
}
.answer-sources > summary .icon {
  width: 12px;
  height: 12px;
}
.memory-sources summary {
  cursor: pointer;
}
.proposal-link {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 13px;
}
.proposal-link:hover {
  text-decoration: none;
  background: var(--accent);
}
/* Which model answered (the router's choice), its reason on hover. */
.route-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  height: 22px;
  margin-top: 10px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  color: var(--muted-foreground);
  cursor: default;
}
.route-chip .icon {
  width: 11px;
  height: 11px;
}
/* What a chat turn did, in order (its steps: what it thought, which tools it called), folded into one quiet
   line once it answered, open while it works; the Approve / Decline card of a waiting one. */
.chat-steps {
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 20px;
  color: var(--muted-foreground);
}
.chat-steps > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  cursor: pointer;
  list-style: none;
  border-radius: 4px;
}
.chat-steps > summary::-webkit-details-marker {
  display: none;
}
.chat-steps > summary:hover {
  color: var(--foreground);
}
.chat-steps > summary .icon {
  width: 14px;
  height: 14px;
  transform: rotate(-90deg);
  transition: transform 0.15s;
}
.chat-steps[open] > summary .icon {
  transform: none;
}
.chat-steps-failed {
  color: var(--destructive-text);
}
.chat-step-list {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0 0 0 4px;
  list-style: none;
}
.chat-step {
  display: grid;
  grid-template-columns: 16px auto minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  min-width: 0;
}
.chat-step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--faint-foreground);
}
.chat-step-icon .icon {
  width: 14px;
  height: 14px;
}
.chat-step[data-state="failed"] .chat-step-icon {
  color: var(--destructive-text);
}
.chat-step-source {
  color: var(--foreground);
  font-weight: 500;
  white-space: nowrap;
}
.chat-step-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.chat-step-label {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}
a.chat-step-label:hover {
  color: var(--foreground);
}
.chat-step-state {
  grid-column: 3;
  font-size: 12px;
  color: var(--warn-text);
}
.chat-step-error {
  grid-column: 2 / -1;
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--destructive-text);
  overflow-wrap: anywhere;
}
.chat-step-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--foreground);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
/* A note between the tool calls: what the model thought or said, one quiet line (all of it on hover). */
.chat-step[data-kind="note"] {
  color: var(--muted-foreground);
}
.chat-step-note {
  grid-column: 2 / -1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}
/* Under an answer: the apps and families it drew on, one chip each (red when a call failed). */
.answer-sources-row {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.sources-label {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--foreground);
}
.source-chip-detail {
  color: var(--muted-foreground);
}
a.source-chip {
  text-decoration: none;
  max-width: 100%;
}
a.source-chip:hover {
  border-color: var(--muted-foreground);
}
a.source-chip .source-chip-name {
  max-width: 36ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-chip[data-tone="danger"] {
  border-color: color-mix(in oklch, var(--destructive-text) 35%, transparent);
}
.source-chip[data-tone="danger"] .source-chip-detail {
  color: var(--destructive-text);
}
.source-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--muted-foreground);
}
.source-chip[data-tone="danger"] .source-mark {
  background: var(--destructive-soft);
  color: var(--destructive-text);
}
/* An answer's components (rich-blocks.js): items from tool results, key numbers, one caveat. */
.rich-refs {
  display: grid;
  margin: 8px 0 16px;
  border-top: 1px solid var(--hairline);
}
.ref-row {
  display: grid;
  grid-template-columns: minmax(48px, auto) minmax(0, 1fr) auto;
  column-gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--foreground);
}
a.ref-row:hover {
  text-decoration: none;
  background: var(--surface-hover);
}
a.ref-row:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}
.ref-num {
  font-size: 13px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.ref-body {
  display: grid;
  min-width: 0;
}
.ref-title {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.ref-repo {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted-foreground);
}
.ref-note {
  font-size: 13px;
  line-height: 20px;
  color: var(--muted-foreground);
}
.ref-row .badge {
  justify-self: end;
}
.ref-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--foreground);
  vertical-align: baseline;
}
a.ref-chip:hover {
  text-decoration: none;
  background: var(--surface-hover);
}
.ref-chip .ref-num {
  font-size: 12px;
}
.ref-chip .ref-title {
  min-width: 0;
  max-width: 32ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.markdown code.ref-missing {
  color: var(--muted-foreground);
}
.ref-row[data-missing] {
  grid-template-columns: minmax(0, 1fr);
}
.ref-row[data-missing] code.ref-missing {
  justify-self: start;
  background: none;
  padding: 0;
}
.markdown p a.ref-chip,
.markdown li a.ref-chip {
  text-decoration: none;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}
@media (max-width: 640px) {
  .stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.stat {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.stat-value {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  color: var(--foreground);
  overflow-wrap: anywhere;
}
.stat-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--muted-foreground);
}
.callout {
  position: relative;
  margin: 16px 0;
  padding: 12px 16px 12px 40px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 14px;
  line-height: 22px;
}
.callout[data-tone="warning"] {
  background: var(--warn-soft);
  color: var(--warn-text);
}
.callout::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 15px;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--callout-icon) center / contain no-repeat;
  mask: var(--callout-icon) center / contain no-repeat;
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
}
.callout[data-tone="warning"]::before {
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 20h20zM12 10v4M12 17h.01'/%3E%3C/svg%3E");
}
.callout p {
  margin: 0;
}
.chat-confirm {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--ring);
  border-radius: 10px;
  background: var(--card);
}
.chat-confirm[data-state="approved"] {
  border-color: var(--border);
}
.chat-confirm[data-state="declined"] {
  border-color: var(--border);
  opacity: 0.8;
}
.chat-confirm-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-confirm-head .icon {
  width: 16px;
  height: 16px;
}
.chat-confirm-args {
  margin: 0;
  font-size: 12px;
  color: var(--muted-foreground);
  overflow-wrap: anywhere;
}
.chat-confirm p {
  margin: 0;
}
/* Under an answer: thumbs, "Retry stronger", and the route chip. */
.answer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
}
.answer-actions .route-chip {
  margin: 0 0 0 6px;
}
.answer-actions .feedback {
  width: 28px;
  height: 28px;
  color: var(--muted-foreground);
}
.answer-actions .feedback .icon {
  width: 14px;
  height: 14px;
}
.answer-actions .feedback[aria-pressed="true"] {
  color: var(--foreground);
  background: var(--surface-selected);
}
.answer-actions .retry-stronger {
  color: var(--muted-foreground);
}
/* A streaming answer's reasoning: open while the model still thinks, folded once its text arrives. */
.reasoning {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted-foreground);
}
.reasoning > summary {
  cursor: pointer;
  width: fit-content;
}
.reasoning p {
  margin: 6px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  white-space: pre-wrap;
  max-height: 200px;
  overflow: auto;
}
.thinking {
  color: var(--muted-foreground);
}
@media (prefers-reduced-motion: no-preference) {
  .thinking {
    animation: thinking 1.6s ease-in-out infinite;
  }
}
@keyframes thinking {
  50% {
    color: var(--foreground);
  }
}

/* ── Memory, Knowledge and Settings: tabs under the header, then content ── */
/* One tab row under the header: Settings, Memory, Knowledge and Inbox. Links use aria-current, buttons role=tab/aria-selected. */
.page-tabs {
  display: flex;
  align-items: center;
  flex: none;
  height: 48px;
  padding: 0 16px;
  scrollbar-width: none;
  margin: 0;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  flex-wrap: nowrap;
}
.page-tabs a,
.page-tabs .btn[role="tab"] {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  color: var(--muted-foreground);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  border-color: transparent;
  background: transparent;
}
.page-tabs a .icon,
.page-tabs .btn[role="tab"] .icon {
  width: 14px;
  height: 14px;
}
.page-tabs a:hover,
.page-tabs .btn[role="tab"]:hover:not(:disabled) {
  text-decoration: none;
  background: var(--muted);
  color: var(--foreground);
}
.page-tabs a[aria-current],
.page-tabs .btn[aria-selected="true"],
.page-tabs .btn[aria-selected="true"]:hover:not(:disabled) {
  color: var(--foreground);
  background: var(--surface-selected);
}
@media (pointer: coarse) {
  .page-tabs .btn[role="tab"] {
    min-height: 40px;
  }
}
.memory-content {
  max-width: 1200px;
  align-content: start;
  padding-inline: 16px;
}
.memory-content p {
  line-height: 1.6;
}
.collection-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted-foreground);
  background: var(--muted);
  margin-bottom: 4px;
}
.collection-icon .icon {
  width: 16px;
  height: 16px;
}
.knowledge-empty {
  padding: 64px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.knowledge-empty > span {
  width: 48px;
  height: 48px;
  display: grid !important;
  place-items: center;
  border-radius: 50%;
  background: var(--muted);
  margin-bottom: 4px;
}
.knowledge-empty > span .icon {
  width: 24px;
  height: 24px;
  color: var(--muted-foreground);
}
.knowledge-empty h3 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0;
}
.knowledge-empty p {
  font-size: 14px;
  line-height: 1.625;
  color: var(--muted-foreground);
  max-width: 448px;
  margin: 0 0 4px;
}
.memory-record {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px;
  color: var(--foreground);
  border-radius: 6px;
}
.memory-record + .memory-record {
  margin-top: 2px;
}
.memory-record:hover {
  text-decoration: none;
  background: color-mix(in oklch, var(--accent) 50%, transparent);
}
.memory-record .grow {
  display: grid;
  gap: 2px;
  flex: 1;
}
.memory-record strong {
  font-size: 14px;
  font-weight: 500;
}
.record-icon {
  height: 32px;
  width: 32px;
  display: grid;
  place-items: center;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 50%;
  flex: none;
}
.memory-record > span[aria-hidden]:first-child:not(.record-icon) {
  width: 32px;
  height: 32px;
  display: grid !important;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: var(--muted);
  color: var(--muted-foreground);
}
.memory-settings {
  display: grid;
  gap: 28px;
}
.memory-content details > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.memory-content details[open] > summary {
  margin-bottom: 16px;
}
/* Disclosures open with a quiet chevron instead of the browser triangle. */
.memory-content details > summary,
.inbox-events > summary,
.inbox-trace > summary,
.memory-sources summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.memory-content details > summary::-webkit-details-marker,
.inbox-events > summary::-webkit-details-marker,
.inbox-trace > summary::-webkit-details-marker,
.memory-sources summary::-webkit-details-marker {
  display: none;
}
.memory-content details > summary::before,
.inbox-events > summary::before,
.inbox-trace > summary::before,
.memory-sources summary::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--faint-foreground);
  transition: transform 0.12s;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E")
    center / 12px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}
.memory-content details[open] > summary::before,
.inbox-events[open] > summary::before,
.inbox-trace[open] > summary::before,
.memory-sources details[open] > summary::before {
  transform: rotate(90deg);
}
.memory-content .answer-sources > summary::before {
  display: none;
}
.memory-content details .field {
  margin-block: 16px;
}
.memory-before {
  border-color: var(--destructive);
  background: var(--destructive-soft);
}
.memory-after {
  border-color: var(--ok);
  background: var(--ok-soft);
}
.memory-content .notice h3 {
  margin-top: 0;
}
.source-index {
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  background: var(--muted);
  border-radius: 4px;
  margin-right: 8px;
}
.grow {
  flex: 1;
  min-width: 0;
}
.memory-content p a,
.markdown p a,
.markdown li a {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.template-card {
  display: grid;
  gap: 12px;
  align-content: start;
}
.template-card h3 {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  margin: 0;
}
.template-card .btn {
  justify-self: start;
}
.template-card > div:last-child:not(:empty) {
  grid-column: 1 / -1;
}
.template-card:has(iframe) {
  grid-column: 1 / -1;
}
/* The workflow editor: the header holds the title, state and Publish / Run. */
.main[data-workspace-editor] > .topbar {
  gap: 8px;
}

/* ── Collapsed sidebar: an icon rail that keeps every destination ───────── */
:root[data-sidebar-collapsed="true"] .sidebar {
  width: 56px;
}
:root[data-sidebar-collapsed="true"] .sidebar-resize {
  display: none;
}
:root[data-sidebar-collapsed="true"] .sidebar-collapse {
  margin-right: 0;
}
:root[data-sidebar-collapsed="true"] .sidebar .brand-name,
:root[data-sidebar-collapsed="true"] .sidebar .nav-group-label {
  display: none;
}
/* The rail has no group labels: a hairline separates the groups instead. */
:root[data-sidebar-collapsed="true"] .nav-group + .nav-group {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}
:root[data-sidebar-collapsed="true"] .sidebar-brand {
  flex-direction: column;
  gap: 4px;
}
:root[data-sidebar-collapsed="true"] .workspace-switch {
  flex: none;
  width: 40px;
  justify-content: center;
  padding: 0;
}
:root[data-sidebar-collapsed="true"] .nav a {
  justify-content: center;
  padding-inline: 0;
}
:root[data-sidebar-collapsed="true"] .sidebar-foot {
  margin-top: auto;
}
:root[data-sidebar-collapsed="true"] .sidebar-account {
  flex-direction: column;
}
:root[data-sidebar-collapsed="true"] .nav .account-link {
  flex: none;
  width: 40px;
}
:root[data-sidebar-collapsed="true"] .nav,
:root[data-sidebar-collapsed="true"] .sidebar-account,
:root[data-sidebar-collapsed="true"] .sidebar-brand {
  padding-inline: 0;
}
:root[data-sidebar-collapsed="true"] .sidebar .nav a .badge:not([hidden]) {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  padding: 0;
  font-size: 0;
  border-radius: 50%;
  background: var(--accent-brand);
  box-shadow: 0 0 0 1px var(--sidebar);
}
:root[data-sidebar-collapsed="true"] .sidebar .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 900px) {
  .sidebar {
    display: flex;
    width: 56px;
  }
  .sidebar-brand {
    flex-direction: column;
    gap: 4px;
  }
  .workspace-switch {
    flex: none;
    width: 40px;
    justify-content: center;
    padding: 0;
  }
  .sidebar .brand-name,
  .sidebar-collapse,
  .sidebar .nav-group-label,
  .sidebar-resize {
    display: none;
  }
  .nav-group + .nav-group {
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid var(--border);
  }
  .sidebar .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .nav,
  .sidebar-account,
  .sidebar-brand {
    padding-inline: 0;
  }
  .sidebar .nav a .badge:not([hidden]) {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
    background: var(--accent-brand);
    box-shadow: 0 0 0 1px var(--sidebar);
  }
  .app-workspace {
    padding: 0;
  }
  .main[data-leaving] {
    inset: 0;
  }
  .main {
    border-radius: 0;
    box-shadow: none;
  }
  .sidebar {
    border-right: 1px solid var(--border);
  }
  .nav a {
    justify-content: center;
    padding-inline: 0;
  }
  .sidebar-foot {
    margin-top: auto;
  }
  .sidebar-account {
    flex-direction: column;
  }
  .nav .account-link {
    flex: none;
    width: 40px;
  }
  .content {
    padding: 20px 20px 40px;
  }
  .settings {
    padding: 20px 20px 48px;
  }
  .sidebar .nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}
@media (max-width: 700px) {
  .page-tabs {
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  .memory-record {
    gap: 10px;
    flex-wrap: wrap;
  }
  .memory-record .grow {
    min-width: 120px;
  }
  .page-tabs {
    padding-inline: 8px;
  }
  .template-grid {
    grid-template-columns: 1fr;
  }
  .topbar:has(.wf-title) {
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    align-content: center;
    row-gap: 6px;
    padding-block: 8px;
  }
  .topbar .wf-title {
    flex: 1;
    max-width: calc(100% - 40px);
    min-width: 80px;
  }
  .topbar .save-hint,
  .topbar .topbar-ready {
    display: none;
  }
  .topbar:has(.wf-title) > .spacer {
    flex-basis: 100%;
    height: 0;
  }
}
@media (max-width: 420px) {
  .content {
    padding: 16px 12px 32px;
  }
  .settings {
    padding-inline: 12px;
  }
  .topbar {
    padding: 0 12px;
  }
  .chat-project-select {
    max-width: 115px;
  }
  .chat-stage {
    --chat-gutter: 12px;
  }
  .user-message-text {
    max-width: 92%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 900px) {
  .editor {
    overflow-y: auto;
    grid-template-rows: minmax(360px, 55vh) minmax(500px, auto) auto;
    align-content: start;
  }
  .editor > .side-panel .inspector,
  .editor > .side-panel .chat-panel {
    flex: none;
  }
  .editor > .runs[data-collapsed="true"] {
    min-height: 40px;
    height: 40px;
  }
  .editor > .side-panel {
    min-height: 500px;
  }
  .editor > .side-panel .inspector,
  .editor > .side-panel .chat-log {
    overflow: visible;
    max-height: none;
  }
  .editor > .runs {
    min-height: 260px;
    height: auto;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .runs-list {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 160px;
  }
}

/* ── Issues & projects ─────────────────────────────────────────────────── */
.content[data-wide] {
  max-width: none;
  grid-template-columns: minmax(0, 1fr);
}
.pm-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.pm-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pm-toolbar .input {
  width: auto;
  min-width: 140px;
}
.pm-toolbar input[type="search"] {
  min-width: 220px;
}
.pm-toolbar .spacer {
  flex: 1;
}
.pm-tabs {
  margin: 0;
}
.pm-tabs .side-tab {
  padding: 0 14px;
}
/* The Board view: one column per status on a faint fill, headed like a band of the List view; cards are flat tiles. */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 1fr);
  gap: 10px;
  overflow-x: auto;
  align-items: stretch;
  padding-bottom: 8px;
}
.board-col {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  border-radius: 10px;
  background: color-mix(in oklch, var(--muted) 35%, transparent);
  overflow: hidden;
}
.board-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  background: color-mix(in oklch, var(--muted) 60%, transparent);
}
.board-col-head .count {
  color: var(--muted-foreground);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.board-cards {
  display: grid;
  gap: 6px;
  min-height: 56px;
  padding: 6px;
  align-content: start;
}
.board-cards:empty::before {
  content: "No issues";
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 6px;
  font-size: 13px;
  color: var(--muted-foreground);
}
.issue-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  cursor: grab;
  background: var(--card);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--hairline);
  transition: box-shadow 0.15s;
}
.issue-card:hover {
  box-shadow:
    0 0 0 1px var(--ring-soft),
    0 1px 3px var(--hairline);
}
.issue-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
.issue-card.dragging {
  opacity: 0.4;
}
.issue-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}
.issue-card .issue-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
  color: var(--foreground);
}
.issue-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted-foreground);
}
.issue-card .meta .icon {
  width: 12px;
  height: 12px;
  margin-right: 2px;
}
.issue-card .meta .priority-glyph .icon {
  width: 14px;
  height: 14px;
  margin: 0;
}
.issue-card .meta .project-name {
  max-width: 100%;
}
.project-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: none;
  background: var(--project-colour, var(--project-gray));
}
.project-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.project-name .project-dot {
  margin-top: 1px;
}
.assignees {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  flex: none;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--foreground);
  background: var(--secondary);
  box-shadow: 0 0 0 1px var(--hairline);
}
.agent-badge .icon {
  width: 12px;
  height: 12px;
  margin: 0;
}
.issue-chat-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.issue-chat-link .icon {
  width: 14px;
  height: 14px;
}
.issue-report {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  max-height: 320px;
  overflow: auto;
}
.issue-report h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.issue-report h3 .icon {
  width: 13px;
  height: 13px;
}
.issue-report .markdown > :first-child {
  margin-top: 0;
}
.issue-report .markdown > :last-child {
  margin-bottom: 0;
}
/* Project log (project-log.js): days of entries, each with who did it; a chat opens to its turns. */
.log-workspace {
  display: grid;
  gap: 16px;
}
.log-filter {
  margin: 0;
}
.log-body {
  display: grid;
  gap: 20px;
}
.log-day {
  display: grid;
  gap: 4px;
}
.log-day-head {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.log-entry {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: var(--radius);
}
.log-entry:hover {
  background: color-mix(in oklch, var(--muted) 60%, transparent);
}
.log-entry > summary {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  list-style: none;
  flex: 1;
}
.log-entry > summary::-webkit-details-marker {
  display: none;
}
.log-actor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  flex: none;
  background: var(--secondary);
  color: var(--muted-foreground);
  margin-top: 1px;
}
.log-actor[data-agent] {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.log-actor .icon {
  width: 13px;
  height: 13px;
}
.log-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
}
.log-copy p {
  margin: 0;
  overflow-wrap: anywhere;
}
.log-copy time {
  font-size: 12px;
}
.log-chat {
  display: block;
}
.log-turns {
  display: grid;
  gap: 10px;
  margin: 8px 0 4px 34px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
.log-turn {
  display: grid;
  gap: 2px;
  font-size: 13px;
}
.log-turn p {
  margin: 0;
  white-space: pre-wrap;
}
.log-turn[data-role="user"] p {
  font-weight: 500;
}
.log-turns .btn {
  justify-self: start;
}
.log-report > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted-foreground);
}
.log-report .markdown {
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}
/* Above the composer: the project the conversation is about. */
.chat-context-row {
  display: flex;
  align-items: center;
  min-height: 0;
  margin-bottom: 6px;
}
.chat-context-row:has(> [hidden]:only-child) {
  display: none;
}
.chat-project-picker {
  margin-left: -6px;
}

/* The project page (projects.js): its own role names, mapped onto the app's tokens in both themes, so the
   page keeps the app's font and canvas. Amber marks unsaved text, nothing else. */
.main[data-project] {
  --pj-bg: var(--background);
  --pj-sidebar: color-mix(in oklch, var(--sidebar) 60%, var(--background));
  --pj-surface: var(--muted);
  --pj-divider: var(--border);
  --pj-control: var(--input);
  --pj-text: var(--foreground);
  --pj-secondary: var(--muted-foreground);
  --pj-muted: var(--muted-foreground);
  --pj-sep: var(--faint-foreground);
  --pj-selected: var(--surface-selected);
  --pj-unsaved: var(--warn-text);
  --pj-primary: var(--primary);
  --pj-primary-text: var(--primary-foreground);
  background: var(--pj-bg);
  color: var(--pj-text);
}
.main[data-project] .btn:focus-visible,
.main[data-project] .notes-mode-btn:focus-visible,
.main[data-project] .notes-row-main:focus-visible,
.main[data-project] .project-breadcrumb a:focus-visible,
.main[data-project] .project-tabs a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--pj-muted);
}

/* Header: back, the breadcrumb, then the task progress and the settings button. */
.topbar.project-header {
  height: 56px;
  min-height: 56px;
  gap: 12px;
  padding: 0 24px 0 20px;
  border-bottom-color: var(--pj-divider);
}
.project-header .page-back {
  width: 32px;
  height: 32px;
  margin: 0;
  border-radius: 8px;
  color: var(--pj-secondary);
}
.project-header .page-back:hover {
  background: var(--pj-surface);
  color: var(--pj-text);
}
.project-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
}
.project-breadcrumb a {
  color: var(--pj-secondary);
  border-radius: 4px;
  flex: none;
}
.project-breadcrumb a:hover {
  color: var(--pj-text);
  text-decoration: none;
}
.project-crumb-sep {
  color: var(--pj-sep);
}
.topbar .project-crumb {
  font-size: 14px;
  font-weight: 600;
  color: var(--pj-text);
}
.project-summary {
  display: contents;
}
.project-tasks {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--pj-secondary);
  white-space: nowrap;
}
.project-tasks-bar.progress {
  width: 96px;
  height: 4px;
  background: var(--pj-control);
}
.project-tasks-bar.progress > span {
  background: var(--pj-text);
}
.project-tasks-count {
  font-variant-numeric: tabular-nums;
}
.topbar .btn.project-settings-btn {
  width: 32px;
  height: 32px;
  margin-left: 4px;
  border: 1px solid var(--pj-control);
  border-radius: 8px;
  color: var(--pj-secondary);
}
.topbar .btn.project-settings-btn:hover {
  background: var(--pj-surface);
  color: var(--pj-text);
}

/* Project tabs: underlined, never filled. */
.page-tabs.project-tabs {
  height: 44px;
  padding: 0 24px;
  gap: 0;
  align-items: stretch;
  border-bottom-color: var(--pj-divider);
}
.page-tabs.project-tabs a {
  height: auto;
  padding: 0 12px;
  gap: 8px;
  border-radius: 0;
  color: var(--pj-muted);
  background: none;
  box-shadow: inset 0 -2px 0 transparent;
}
.page-tabs.project-tabs a:hover {
  background: none;
  color: var(--pj-text);
}
.page-tabs.project-tabs a[aria-current] {
  background: none;
  color: var(--pj-text);
  box-shadow: inset 0 -2px 0 var(--pj-text);
}

/* Project notes (project-notes.js): the full-height sidebar with its tree, then the editor. */
.page[data-notes] {
  display: flex;
  overflow: hidden;
  container: notes / inline-size;
}
.notes-workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}
.notes-workspace > .knowledge-empty,
.notes-workspace > .notes-loading {
  grid-column: 1 / -1;
}
.notes-loading {
  padding: 24px;
  margin: 0;
}
.notes-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--pj-sidebar);
  border-right: 1px solid var(--pj-divider);
}
.notes-side-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px 0 16px;
}
.notes-side-label {
  flex: 1;
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pj-muted);
}
.notes-side-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn.notes-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--pj-secondary);
}
.btn.notes-icon-btn:hover:not(:disabled) {
  background: var(--pj-surface);
  color: var(--pj-text);
}
.btn.notes-icon-btn .icon,
.btn.notes-new .icon {
  width: 16px;
  height: 16px;
}
.btn.notes-new {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  background: var(--pj-primary);
  color: var(--pj-primary-text);
}
.btn.notes-new:hover:not(:disabled) {
  background: color-mix(in oklch, var(--pj-primary) 88%, transparent);
}
.notes-search {
  flex: none;
  position: relative;
  display: block;
  margin: 0 12px 12px;
}
.notes-search > span {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pj-muted);
  pointer-events: none;
}
.notes-search .icon {
  width: 14px;
  height: 14px;
}
.notes-search-input {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--pj-control);
  border-radius: 8px;
  background: transparent;
  color: var(--pj-text);
  font-size: 13px;
}
.notes-search-input::placeholder {
  color: var(--pj-muted);
}
.notes-search-input:focus {
  outline: none;
  border-color: var(--pj-muted);
}
.notes-search-input::-webkit-search-cancel-button {
  filter: grayscale(1);
  opacity: 0.6;
}
.notes-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 1px;
  padding: 0 8px 12px;
}
.notes-folder,
.notes-folder-body {
  display: grid;
  gap: 1px;
}
.notes-tree-empty {
  margin: 0;
  padding: 8px;
  font-size: 13px;
  color: var(--pj-muted);
}
/* A row: depth indents by the chevron and its gap, so a folder's files sit under its name. */
.notes-row {
  position: relative;
  display: flex;
  align-items: center;
  height: 32px;
  border-radius: 6px;
  padding-left: calc(8px + var(--depth, 0) * 18px);
}
.notes-row:hover {
  background: var(--pj-surface);
}
.notes-row-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--pj-secondary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.notes-row-main:hover {
  text-decoration: none;
  color: var(--pj-text);
}
.notes-row-main .icon {
  width: 14px;
  height: 14px;
  color: var(--pj-muted);
}
.notes-file .notes-row-main {
  padding-left: 18px;
}
.notes-folder-toggle {
  color: var(--pj-text);
  font-weight: 500;
}
.notes-folder-toggle > span:first-child {
  margin-right: -4px;
}
.notes-chevron {
  transition: transform 0.15s;
}
.notes-folder:not([data-open]) .notes-chevron {
  transform: rotate(-90deg);
}
.notes-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-count {
  flex: none;
  font-size: 12px;
  font-weight: 400;
  color: var(--pj-muted);
  font-variant-numeric: tabular-nums;
}
.notes-file[data-current] {
  background: var(--pj-selected);
}
.notes-file[data-current] .notes-row-main {
  color: var(--pj-text);
  font-weight: 500;
}
.notes-file[data-current] .notes-row-main .icon {
  color: var(--pj-secondary);
}
.notes-dirty {
  flex: none;
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--pj-unsaved);
}
.btn.notes-row-more {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  opacity: 0;
}
.btn.notes-row-more .icon {
  width: 14px;
  height: 14px;
}
.notes-row:is(:hover, :focus-within) .notes-row-more,
.notes-row-more[aria-expanded="true"] {
  opacity: 1;
}
.notes-row:is(:hover, :focus-within) :is(.notes-count, .notes-dirty) {
  visibility: hidden;
}
@media (hover: none) {
  .btn.notes-row-more {
    opacity: 1;
  }
  .notes-row :is(.notes-count, .notes-dirty) {
    margin-right: 28px;
  }
}

.notes-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--pj-bg);
}
.notes-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--pj-divider);
}
.notes-path {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  color: var(--pj-secondary);
  white-space: nowrap;
}
.notes-path-dir {
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-path-sep {
  color: var(--pj-sep);
}
.notes-path-file {
  color: var(--pj-text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-unsaved {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--pj-unsaved);
}
.notes-bar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}
.notes-mode {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--pj-control);
  border-radius: 8px;
  background: var(--pj-surface);
}
.notes-mode-btn {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--pj-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.notes-mode-btn:hover {
  color: var(--pj-text);
}
.notes-mode-btn[aria-pressed="true"] {
  background: var(--pj-control);
  color: var(--pj-text);
}
.notes-bar .btn.notes-icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--pj-control);
}
.notes-divider {
  width: 1px;
  height: 20px;
  background: var(--pj-divider);
}
.notes-bar .btn.notes-discard,
.notes-bar .btn.notes-save {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.btn.notes-discard {
  color: var(--pj-secondary);
}
.btn.notes-discard:hover:not(:disabled) {
  background: var(--pj-surface);
  color: var(--pj-text);
}
.btn.notes-save {
  gap: 8px;
  background: var(--pj-primary);
  color: var(--pj-primary-text);
}
.btn.notes-save:hover:not(:disabled) {
  background: color-mix(in oklch, var(--pj-primary) 88%, transparent);
}
.notes-kbd {
  font: inherit;
  font-size: 11px;
  opacity: 0.7;
}
.notes-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  cursor: text;
}
.notes-sheet {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 808px;
  min-height: 100%;
  margin: 0 auto;
  padding: 40px 24px 96px;
}
.notes-text {
  flex: 1 0 auto;
  width: 100%;
  min-height: 240px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--pj-text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.75;
  tab-size: 2;
  caret-color: var(--pj-text);
}
.notes-text::placeholder {
  color: var(--pj-muted);
}
.notes-preview {
  cursor: auto;
}
.notes-preview .markdown {
  font-size: 15px;
  line-height: 1.75;
}
.notes-picture {
  align-items: flex-start;
  cursor: auto;
}
.notes-image,
.markdown img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--hairline);
}
.notes-status {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 36px;
  padding: 0 24px;
  border-top: 1px solid var(--pj-divider);
  font-size: 12px;
  color: var(--pj-muted);
  white-space: nowrap;
}
.notes-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-status-left > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.notes-status-sep {
  color: var(--pj-sep);
}
.notes-status code {
  font-size: 12px;
  color: var(--pj-secondary);
  background: none;
  padding: 0;
}
.notes-status-right {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.notes-empty {
  margin: auto;
}

/* Narrow: the sidebar stacks above the editor. */
@container notes (max-width: 800px) {
  .notes-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .notes-sidebar {
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid var(--pj-divider);
  }
  .notes-bar {
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 10px 16px;
  }
  .notes-bar-actions {
    gap: 8px;
  }
  .notes-sheet {
    padding: 24px 16px 64px;
  }
  .notes-status {
    padding: 0 16px;
  }
}
@media (max-width: 640px) {
  .project-tasks-label,
  .project-tasks-bar {
    display: none;
  }
  .topbar.project-header {
    padding-inline: 12px 16px;
  }
  .page-tabs.project-tabs {
    padding-inline: 12px;
  }
}
.colour-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  align-items: center;
}
.colour-swatch {
  position: relative;
  display: inline-flex;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  cursor: pointer;
  background: var(--project-colour);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--foreground) 15%, transparent);
}
.colour-swatch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.colour-swatch:has(input:checked) {
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--project-colour);
}
.colour-swatch:has(input:focus-visible) {
  box-shadow:
    0 0 0 2px var(--background),
    0 0 0 4px var(--ring);
}
/* The Issues page: the board takes the page's height and each column scrolls on its own. */
.content[data-full] {
  height: 100%;
  padding: 16px 20px 20px;
  gap: 16px;
  grid-template-rows: minmax(0, 1fr);
}
.pm-workspace[data-full] {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.pm-workspace[data-full] .pm-body {
  min-height: 0;
  overflow-y: auto;
}
.pm-workspace[data-full] .board {
  height: 100%;
  grid-template-rows: minmax(0, 1fr);
  padding-bottom: 0;
}
.pm-workspace[data-full] .board-col {
  max-height: 100%;
}
.pm-workspace[data-full] .board-cards {
  overflow-y: auto;
}
.issue-key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  flex: none;
}
.overdue {
  color: var(--destructive-text);
  display: inline-flex;
  align-items: center;
}
.drop-marker {
  height: 2px;
  margin: 0 4px;
  border-radius: 2px;
  background: var(--accent-brand);
}
.project-row .project-name .project-dot {
  width: 10px;
  height: 10px;
}
.link-button {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-weight: 500;
}
.link-button:hover {
  text-decoration: underline;
}
/* The List view: a flat list on the canvas, one band per status, 38px rows (after Multica and Linear). */
.issue-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
}
.issue-list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  border-top: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 50%, transparent);
}
.issue-list-head .count {
  color: var(--muted-foreground);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.issue-list-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.issue-list-row:hover {
  background: color-mix(in oklch, var(--muted) 40%, transparent);
}
.issue-list-row:has(.issue-list-title:focus-visible) {
  box-shadow: inset 0 0 0 2px var(--ring);
}
.issue-list-row .issue-key {
  font-size: 12px;
  min-width: 3ch;
}
/* The title opens the issue; its ::after stretches the click over the whole row. */
.issue-list-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
}
.issue-list-title::after {
  content: "";
  position: absolute;
  inset: 0;
}
.issue-list-title:focus-visible {
  outline: none;
}
.issue-list-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex: none;
  font-size: 12px;
  color: var(--muted-foreground);
}
.issue-list-meta .assignees {
  margin-left: 0;
}
.issue-list-meta .icon {
  width: 12px;
  height: 12px;
  margin-right: 2px;
}
.issue-list-meta .project-name {
  max-width: 180px;
}
.issue-list-action {
  position: relative;
  z-index: 1;
  flex: none;
  margin-left: 4px;
  color: var(--muted-foreground);
}
.issue-list-row:hover .issue-list-action,
.issue-list-action:focus-visible {
  color: var(--foreground);
}
.issue-list-empty {
  display: flex;
  align-items: center;
  height: 38px;
  margin: 0;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted-foreground);
}
.issue-list-foot {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
/* Status and priority glyphs; the text tones, since the light fills are too faint for thin strokes. */
.status-glyph,
.priority-glyph {
  display: inline-flex;
  flex: none;
  color: var(--muted-foreground);
}
.status-glyph .icon,
.priority-glyph .icon {
  width: 14px;
  height: 14px;
}
.status-glyph[data-tone="accent"],
.priority-glyph[data-tone="accent"] {
  color: var(--accent-brand);
}
.status-glyph[data-tone="warn"],
.priority-glyph[data-tone="warn"] {
  color: var(--warn-text);
}
.status-glyph[data-tone="danger"],
.priority-glyph[data-tone="danger"] {
  color: var(--destructive-text);
}
.status-glyph[data-tone="ok"],
.priority-glyph[data-tone="ok"] {
  color: var(--ok);
}
.priority-glyph[data-level="1"] {
  color: var(--faint-foreground);
}
.priority-glyph[data-level="1"] rect:nth-of-type(n + 2),
.priority-glyph[data-level="2"] rect:nth-of-type(n + 3),
.priority-glyph[data-level="3"] rect:nth-of-type(n + 4) {
  fill: color-mix(in oklch, currentColor 25%, transparent);
}
.priority-glyph[data-level="0"] rect {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-dasharray: 2 1.5;
  opacity: 0.6;
}
.project-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 120px 100px 150px 80px;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.project-row-head {
  padding-block: 8px;
  font-weight: 500;
}
.progress {
  width: 80px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
  flex: none;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--ok);
}
.progress-cell {
  gap: 8px;
}
/* Project settings: a button at the right end of the tab row opens the properties in a dialog. */
.page-tabs .spacer {
  flex: 1;
  min-width: 8px;
}
.project-props {
  display: grid;
  gap: 16px;
}
.modal:has(> .project-settings) {
  width: min(680px, calc(100vw - 32px));
}
.project-settings .card-head {
  padding: 28px 28px 20px;
}
.project-settings .card-body {
  padding: 0 28px 28px;
}
.project-settings .card-foot {
  justify-content: flex-start;
  padding: 16px 28px;
}
@media (max-width: 900px) {
  .project-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .project-row > :nth-child(n + 3),
  .project-row-head {
    display: none;
  }
  .board {
    grid-auto-columns: minmax(240px, 80vw);
  }
  .issue-list-meta .project-name {
    display: none;
  }
}

/* ── Workflow panel (Manual tab, no step selected) ─────────────────────── */
.inspector {
  display: flex;
  flex-direction: column;
}
.inspector-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.inspector-inner.wf-settings {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
  margin-bottom: 8px;
}
.inspector .section-head h3 {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.section-action.link-button {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-text);
  text-decoration: none;
}
.section-action.link-button:hover {
  text-decoration: underline;
}
.manual-add {
  padding: 16px;
}
.manual-add .section-head {
  margin-bottom: 10px;
}
.setting-card {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  min-width: 0;
}
.setting-card.repo-binding {
  display: block;
}
.setting-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 60px;
  padding: 12px 16px;
  min-width: 0;
}
.setting-row + .setting-row {
  border-top: 1px solid var(--border);
}
.setting-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.setting-row > .setting-label {
  flex: 1 0 auto;
}
.wf-settings .repo-row {
  flex-wrap: nowrap;
}
.setting-row > .field.grow {
  flex: 1;
  min-width: 0;
}
.setting-row > .field .hint {
  margin: 0;
}
.setting-value {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.setting-value .btn .icon {
  width: 14px;
  height: 14px;
}
.info-tip {
  display: inline-flex;
  color: var(--muted-foreground);
  cursor: help;
  border-radius: 999px;
}
.info-tip .icon {
  width: 14px;
  height: 14px;
}
.info-tip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring-soft);
}
.wf-settings .wf-slug {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 0;
  background: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* A row of choices, one on: the inbox delivery setting. */
.seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}
.seg [role="radio"] {
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.seg [role="radio"]:hover {
  color: var(--foreground);
}
.seg [role="radio"][aria-checked="true"] {
  background: var(--muted);
  color: var(--foreground);
}
.seg [role="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring-soft);
}

.wf-settings .repo-row {
  align-items: center;
}
.wf-settings .repo-row .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.wf-settings .repo-row .title {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}
.wf-settings .repo-row a.title:hover {
  text-decoration: underline;
}
.repo-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--muted-foreground);
}
.repo-tile .icon {
  width: 16px;
  height: 16px;
}
.setting-row.notice {
  min-height: 0;
  border-radius: 0;
  font-size: 13px;
}
.setting-row.code-details {
  display: block;
  min-height: 0;
  padding: 8px 16px;
}
.setting-row.code-details > summary {
  font-size: 13px;
  color: var(--muted-foreground);
}
.setting-row.code-details[open] {
  padding-bottom: 16px;
}

/* Activity: the draft and published versions on a timeline, newest first. */
.activity {
  display: grid;
  gap: 18px;
  padding: 16px;
}
.activity-group {
  position: relative;
  display: grid;
  gap: 8px;
  padding-left: 20px;
  min-width: 0;
}
.activity-group::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted-foreground);
}
.activity-group[data-kind="live"]::before {
  background: var(--ok);
}
.activity-group[data-kind="draft"]::before {
  left: 0;
  width: 4px;
  height: 4px;
  border: 2px solid var(--warn);
  background: none;
}
.activity-group[data-kind="draft"]:has(.activity-lines)::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 18px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}
.activity-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 14px;
  line-height: 16px;
}
.activity-head strong {
  font-weight: 600;
}
.activity-head .badge {
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  align-self: center;
}
.activity-lines {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.activity-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-size: 14px;
  min-width: 0;
}
.activity-line > .link-button {
  min-width: 0;
  overflow-wrap: anywhere;
  text-decoration: none;
  font-weight: 400;
  color: var(--foreground);
}
.activity-line > .link-button:hover {
  text-decoration: underline;
}
.activity-line .spacer {
  flex: 1;
}
.activity-line time {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.activity-line .btn {
  flex: none;
}
.activity-line[data-undone="true"] > .link-button,
.activity-line[data-undone="true"] > :not(.badge, .spacer, time, .btn) {
  text-decoration: line-through;
  color: var(--muted-foreground);
}
.activity-restore.link-button {
  justify-self: start;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-text);
  text-decoration: none;
}
.activity-restore.link-button:hover {
  text-decoration: underline;
}

.danger-zone {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid color-mix(in oklch, var(--destructive) 35%, transparent);
  border-radius: 10px;
}
.danger-zone .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.danger-zone strong {
  font-size: 14px;
  font-weight: 600;
}
.danger-zone .btn[data-variant="destructive"] {
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--destructive) 35%, transparent);
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}
.topbar-status .hint {
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
@media (max-width: 1100px) {
  .topbar-status .hint {
    display: none;
  }
}
