/* Inter Latin (variable), shipped with the editor. See docs/brand.md. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('inter-latin.woff2') format('woff2');
}

:root {
  --bg: #f4f6f8;
  --sidebar: #ffffff;
  --topbar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --border-strong: #d0d5dc;
  --text: #12141a;
  --muted: #5c6570;
  --accent: #1c4ed8;
  --accent-fill: #1c4ed8;
  --accent-fill-hover: #1a45c2;
  --accent-text: #ffffff;
  --accent-soft: #e8efff;
  --trigger: #e15a1c;
  --success: #1a7f42;
  --success-soft: #e5f6ec;
  --danger: #d1242f;
  --danger-soft: #fdeced;
  --warning: #b86e00;
  --edge: #8b93a1;
  --grid-dot: #d5dae2;
  --overlay: rgb(12 14 18 / 46%);
  --warning-soft: #fff6e5;
  --knob: #ffffff;
  --shadow: 0 1px 1px rgb(18 20 26 / 4%), 0 1px 2px rgb(18 20 26 / 5%);
  --shadow-md: 0 8px 24px rgb(18 20 26 / 8%), 0 1px 2px rgb(18 20 26 / 6%);
  --node-shadow: drop-shadow(0 1px 1px rgb(18 20 26 / 5%)) drop-shadow(0 6px 14px rgb(18 20 26 / 6%));
  --radius: 8px;
  --radius-sm: 6px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0c0e12;
    --sidebar: #101218;
    --topbar: #101218;
    --surface: #161922;
    --surface-2: #1e222c;
    --border: #2a2f3a;
    --border-strong: #3a4150;
    --text: #f3f5f7;
    --muted: #959eac;
    --accent: #9ebbff;
    --accent-fill: #2f6fe0;
    --accent-fill-hover: #3d7cf2;
    --accent-text: #ffffff;
    --accent-soft: #1a2744;
    --trigger: #ff8a4c;
    --success: #3fb96a;
    --success-soft: #13281c;
    --danger: #f85149;
    --danger-soft: #3a171b;
    --warning: #e3b341;
    --edge: #6d7686;
    --grid-dot: #262b36;
    --overlay: rgb(0 0 0 / 58%);
    --warning-soft: #3a2e14;
    --knob: #ffffff;
    --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 8px 24px rgb(0 0 0 / 28%);
    --shadow-md: 0 16px 40px rgb(0 0 0 / 45%), 0 1px 2px rgb(0 0 0 / 40%);
    --node-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / 35%)) drop-shadow(0 8px 18px rgb(0 0 0 / 35%));
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0c0e12;
  --sidebar: #101218;
  --topbar: #101218;
  --surface: #161922;
  --surface-2: #1e222c;
  --border: #2a2f3a;
  --border-strong: #3a4150;
  --text: #f3f5f7;
  --muted: #959eac;
  --accent: #9ebbff;
  --accent-fill: #2f6fe0;
  --accent-fill-hover: #3d7cf2;
  --accent-text: #ffffff;
  --accent-soft: #1a2744;
  --trigger: #ff8a4c;
  --success: #3fb96a;
  --success-soft: #13281c;
  --danger: #f85149;
  --danger-soft: #3a171b;
  --warning: #e3b341;
  --edge: #6d7686;
  --grid-dot: #262b36;
  --overlay: rgb(0 0 0 / 58%);
  --warning-soft: #3a2e14;
  --knob: #ffffff;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 8px 24px rgb(0 0 0 / 28%);
  --shadow-md: 0 16px 40px rgb(0 0 0 / 45%), 0 1px 2px rgb(0 0 0 / 40%);
  --node-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / 35%)) drop-shadow(0 8px 18px rgb(0 0 0 / 35%));
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

a {
  color: inherit;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------------------------------------------------------------- controls */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 550;
  letter-spacing: -0.011em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

button:hover:not(:disabled),
.button:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button:focus-visible,
.button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-fill);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--accent-fill);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  color: var(--accent-text);
  font-weight: 600;
}

.primary:hover:not(:disabled) {
  background: var(--accent-fill-hover);
  border-color: var(--accent-fill-hover);
}

.ghost {
  background: transparent;
  border-color: transparent;
}

.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: transparent;
}

.danger {
  color: var(--danger);
}

.small {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

button.icon {
  width: 32px;
  padding: 0;
  font-size: 18px;
}

input[type='text'],
input[type='password'],
input[type='search'],
input[type='time'],
input[type='number'],
input:not([type]),
select,
textarea {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input:not([type='checkbox']):not([type='radio']):not([type='range']):hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

textarea {
  resize: vertical;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 12px 0 10px;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
}

.spacer {
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 2px 8px;
  text-decoration: none;
  color: inherit;
}

.brand img,
.editor-mark img,
.login img {
  display: block;
  border-radius: 7px;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}

.brand-name {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-short {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.editor-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 2px;
  border-radius: 7px;
  text-decoration: none;
}

.editor-mark:hover {
  background: var(--surface-2);
}

.back {
  font-size: 20px;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}

.back:hover {
  background: var(--surface-2);
}

.wf-title {
  max-width: 320px;
  border-color: transparent !important;
  background: transparent !important;
  font-size: 16px !important;
  font-weight: 600;
}

.wf-title:hover,
.wf-title:focus {
  border-color: var(--border) !important;
}

.dirty {
  color: var(--warning);
  font-size: 12px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin-right: 6px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch .track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border);
  transition: background 0.15s;
}

.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--knob);
  transition: transform 0.15s;
}

.switch input:checked + .track {
  background: var(--success);
}

.switch input:checked + .track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch input:disabled + .track {
  opacity: 0.5;
}

/* ---------------------------------------------------------------- home */

.home-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 16px;
}

.home-main h1 {
  margin-bottom: 20px;
  font-size: 24px;
}

.wf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.wf-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
}

.wf-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.wf-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-name:hover strong {
  color: var(--accent);
}

.pill {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.pill.on {
  background: var(--success-soft);
  color: var(--success);
}

.empty {
  padding: 48px 24px;
  text-align: center;
}

.empty h2 {
  margin-bottom: 8px;
}

.empty p {
  margin: 0 0 20px;
}

.fatal {
  padding: 40px 16px;
  text-align: center;
}

/* ---------------------------------------------------------------- login */

.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(880px 420px at 50% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 68%),
    var(--bg);
}

.login {
  width: min(400px, 100%);
  padding: 32px 28px 24px;
  display: grid;
  gap: 12px;
  justify-items: start;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.login h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.login .brand-short {
  margin: 2px 0 0;
  font-size: 11px;
}

.login p {
  margin: 0;
}

.login button {
  width: 100%;
}

/* ---------------------------------------------------------------- editor */

.editor {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  outline: none;
  cursor: default;
  font-family: var(--font);
}

.canvas text {
  font-family: var(--font);
}

.canvas.panning {
  cursor: grabbing;
}

.grid {
  pointer-events: all;
}

.grid-dot {
  fill: var(--grid-dot);
}

.canvas-tools {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  gap: 6px;
}

.canvas-tools {
  gap: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

/* One joined control: zoom in, zoom out, fit. */
.canvas-tools button {
  border-radius: 0;
  box-shadow: none;
}

.canvas-tools button + button {
  margin-left: -1px;
}

.canvas-tools button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.canvas-tools button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.add-node {
  position: absolute;
  top: 16px;
  right: 16px;
  gap: 6px;
  box-shadow: var(--shadow-md);
}

.add-node span {
  font-size: 18px;
  line-height: 1;
}

button.empty-hint {
  height: auto;
  line-height: 1.4;
}

.empty-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  flex-direction: column;
  gap: 2px;
  width: min(280px, calc(100% - 48px));
  height: auto;
  padding: 22px 20px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
  text-align: center;
  white-space: normal;
}

.empty-hint strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-hint span:last-child {
  font-size: 13px;
  line-height: 1.45;
}

.empty-hint .plus {
  font-size: 40px;
  line-height: 1;
  font-weight: 300;
}

.empty-hint:hover {
  color: var(--accent);
}

.banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  font-size: 13px;
}

/* nodes */

.node {
  cursor: grab;
}

.node-body {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1.5;
  filter: var(--node-shadow);
}

/* Triggers: a warm tint, and a bolt badge where an input would be. */
.node.trigger .node-body {
  fill: color-mix(in srgb, var(--trigger) 7%, var(--surface));
  stroke: color-mix(in srgb, var(--trigger) 45%, var(--border, #d8dae3));
}

.node:hover .node-body {
  stroke: var(--muted);
}

.node.selected .node-body {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.trigger-badge circle {
  fill: var(--trigger);
  stroke: var(--bg);
  stroke-width: 2.5;
}

.trigger-badge path {
  fill: var(--accent-text);
}

.node.success .node-body {
  stroke: var(--success);
}

.node.error .node-body {
  stroke: var(--danger);
  stroke-width: 2.5;
}

.node.selected.success .node-body,
.node.selected.error .node-body {
  stroke-dasharray: 6 3;
}

.node.disabled {
  opacity: 0.55;
}

.node.unknown .node-body {
  stroke: var(--danger);
  stroke-dasharray: 4 3;
}

.node-icon {
  fill: var(--accent-soft);
}

.node.trigger .node-icon {
  fill: color-mix(in srgb, var(--trigger) 18%, transparent);
}

.node-glyph {
  fill: var(--accent);
  font-size: 15px;
  font-weight: 700;
  pointer-events: none;
}

.node.trigger .node-glyph {
  fill: var(--trigger);
}

.node-title {
  fill: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  pointer-events: none;
}

.node-subtitle {
  fill: var(--muted);
  font-size: 11.5px;
  pointer-events: none;
}

.node-status {
  font-size: 11.5px;
  font-weight: 600;
  fill: var(--success);
}

.node.error .node-status {
  fill: var(--danger);
}

.node-warning circle {
  fill: var(--warning);
}

.node-warning text {
  fill: var(--accent-text);
  font-size: 12px;
  font-weight: 700;
}

.port {
  fill: var(--surface);
  stroke: var(--edge);
  stroke-width: 2;
}

.port.out {
  cursor: crosshair;
}

.port:hover {
  fill: var(--accent);
  stroke: var(--accent);
}

.port-label {
  fill: var(--muted);
  font-size: 10.5px;
  pointer-events: none;
}

.add-handle {
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}

.node:hover .add-handle,
.node.selected .add-handle {
  opacity: 1;
}

.add-handle line {
  stroke: var(--edge);
  stroke-width: 2;
}

.add-handle rect {
  fill: var(--surface);
  stroke: var(--edge);
  stroke-width: 1.5;
}

.add-handle text {
  fill: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.add-handle:hover rect {
  stroke: var(--accent);
}

.add-handle:hover text {
  fill: var(--accent);
}

/* edges */

.edge {
  cursor: pointer;
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
}

.edge-line,
.draft {
  fill: none;
  stroke: var(--edge);
  stroke-width: 2;
}

.arrow-head {
  fill: var(--edge);
}

.draft {
  stroke: var(--accent);
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.edge:hover .edge-line {
  stroke: var(--muted);
}

.edge.has-data .edge-line {
  stroke: var(--success);
}

.edge.selected .edge-line {
  stroke: var(--accent);
  stroke-width: 3;
}

.edge-port-label {
  fill: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  /* A halo in the canvas colour, so the name reads cleanly on top of the line. */
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 5px;
  stroke-linejoin: round;
  pointer-events: none;
}

.edge.selected .edge-port-label { fill: var(--accent); }
.port.out.error { stroke: var(--danger); }
.edge.error-branch .edge-line { stroke: color-mix(in srgb, var(--danger) 70%, var(--muted)); stroke-dasharray: 5 4; }
.edge.error-branch .edge-port-label tspan:first-child { fill: var(--danger); }
.edge-port-count { fill: var(--success); font-weight: 600; }

.edge-label {
  fill: var(--success);
  font-size: 11.5px;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 4px;
  pointer-events: none;
}

.edge-delete circle {
  fill: var(--surface);
  stroke: var(--danger);
  stroke-width: 1.5;
}

.edge-delete text {
  fill: var(--danger);
  font-size: 15px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- drawers */

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow-y: auto;
}

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

.drawer-head h2 {
  flex: 1;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-list h3 {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.palette-item {
  width: 100%;
  height: auto;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px;
  margin-bottom: 4px;
  border-color: transparent;
  background: transparent;
  text-align: left;
  white-space: normal;
}

.palette-item:hover {
  background: var(--surface-2);
}

.palette-item > span:last-child {
  display: flex;
  flex-direction: column;
}

.palette-item small {
  color: var(--muted);
  font-weight: 400;
}

.palette-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.palette-icon.trigger {
  background: color-mix(in srgb, var(--trigger) 18%, transparent);
  color: var(--trigger);
}

.exec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.exec-row {
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  padding: 10px;
  text-align: left;
  white-space: normal;
}

.exec-item {
  position: relative;
}

.exec-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  color: var(--muted);
}

.exec-row {
  padding-right: 36px;
}

.exec-row.current {
  border-color: var(--accent);
}

.exec-meta {
  display: flex;
  flex-direction: column;
}

.exec-error {
  grid-column: 1 / -1;
  color: var(--danger);
  font-weight: 400;
}

.status {
  align-self: start;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-2);
}

.status.success {
  background: var(--success-soft);
  color: var(--success);
}

.status.error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------------------------------------------------------------- node details */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--overlay);
}

.ndv {
  width: min(1280px, 100%);
  height: min(820px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ndv-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--border);
}

.ndv-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ndv-name {
  max-width: 360px;
  padding: 2px 6px !important;
  min-height: 0 !important;
  border-color: transparent !important;
  font-size: 16px !important;
  font-weight: 600;
}

.ndv-name:hover,
.ndv-name:focus {
  border-color: var(--border) !important;
}

.ndv-titles small {
  padding-left: 7px;
}

.ndv-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 1.1fr) 1fr;
}

.ndv-body.two {
  grid-template-columns: minmax(320px, 1fr) 1fr;
}

.pane {
  min-width: 0;
  overflow: auto;
  padding: 16px;
  border-right: 1px solid var(--border);
}

.pane:last-child {
  border-right: none;
}

.pane > h3 {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.params-pane {
  background: var(--surface-2);
}

.params {
  display: grid;
  gap: 14px;
}

.params > p {
  margin: 0;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.field {
  display: grid;
  gap: 5px;
}

.field.inline {
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 8px;
}

.field.inline small {
  grid-column: 2;
}

.field-label {
  font-weight: 600;
  font-size: 13px;
}

.req {
  color: var(--danger);
}

.warn {
  color: var(--warning);
}

.list-rows {
  display: grid;
  gap: 8px;
}

.list-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) 34px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.list-row .field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.add-row {
  justify-self: start;
  color: var(--accent);
}

.code {
  min-height: 220px;
}

.settings {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.settings summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}

.settings .check {
  margin-bottom: 8px;
}

.retry-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 8px 24px;
}

.retry-fields[hidden] {
  display: none;
}

.schedule-preview {
  margin-top: -4px;
}

.next-runs {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.info-box {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 12px;
  border-radius: 8px;
  background: var(--accent-soft);
}

.info-box code {
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
}

.error-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
}

/* data views */

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-2);
}

.tab {
  height: 26px;
  padding: 0 10px;
  border: none;
  background: transparent;
  font-size: 12.5px;
}

.tab.active {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pane > div > .tabs {
  margin-bottom: 10px;
}

.data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
}

th,
td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

th[draggable='true'] {
  cursor: grab;
}

th[draggable='true']:hover {
  color: var(--accent);
}

tr:last-child td {
  border-bottom: none;
}

.json {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12px;
  overflow: auto;
  white-space: pre;
}

/* ---------------------------------------------------------------- toasts */

#toasts {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 8px 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-md);
}

.toast-body {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.toast-close {
  flex: none;
  color: var(--muted);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .ndv-body,
  .ndv-body.two {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .pane {
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .modal-backdrop {
    padding: 0;
  }

  .ndv {
    height: 100%;
    border-radius: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 6px;
    padding: 0 8px;
  }

  .switch .label,
  .brand-lockup {
    display: none;
  }

  .wf-title {
    flex: 1 1 60px;
    min-width: 60px;
  }

  .topbar button {
    padding: 0 10px;
  }

  .topbar button[data-short] {
    font-size: 0;
  }

  .topbar button[data-short]::after {
    content: attr(data-short);
    font-size: 14px;
  }

  .dirty {
    display: none;
  }
}

/* ---------------------------------------------------------------- v0.3: nav, menus, dialogs, selection */

.nav {
  margin-left: 12px;
}

.nav .tab {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
}

.intro,
.page-intro {
  margin: -8px 0 20px;
}

button.wf-name.link {
  height: auto;
  padding: 0;
  border: none;
  background: none;
  align-items: flex-start;
  text-align: left;
  font-weight: inherit;
}

button.wf-name.link:hover strong {
  color: var(--accent);
}

.menu {
  position: fixed;
  z-index: 15;
  min-width: 220px;
  display: grid;
  padding: 6px;
}

.menu button {
  justify-content: flex-start;
  width: 100%;
  font-weight: 400;
}

.menu button:hover {
  background: var(--surface-2);
}

.box-select {
  fill: color-mix(in srgb, var(--accent) 10%, transparent);
  stroke: var(--accent);
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.dialog {
  width: min(460px, 100%);
  max-height: 100%;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 20px;
  box-shadow: var(--shadow-md);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -2px 0 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 640px) {
  .nav {
    margin-left: 0;
  }

  .nav .tab {
    padding: 0 8px;
  }
}

/* ---------------------------------------------------------------- v0.5: accounts, pinned data, OAuth */

.login button.link {
  width: auto;
  height: auto;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  justify-self: center;
}

.login .warn {
  color: var(--danger);
}

.account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .account-name {
    display: none;
  }
}

.node.pinned .node-body {
  stroke-dasharray: 5 3;
}

.node-pin circle {
  fill: var(--accent);
}

.node-pin text {
  fill: var(--accent-text);
  font-size: 10px;
  font-weight: 700;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.pane-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pane-actions {
  display: flex;
  gap: 4px;
}

.pin-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12px;
}

textarea.pin-editor {
  width: 100%;
  margin-bottom: 8px;
}

.info-box.oauth .ok {
  color: var(--success);
  font-weight: 600;
}

@media (max-width: 720px) {
  /* Keep the "Viewing execution" banner clear of the Add node button. */
  .banner {
    top: 64px;
  }
}

.list-row.stacked {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.list-row.stacked > .icon {
  justify-self: end;
  order: -1;
  margin-bottom: -36px;
}

.list-row.stacked .field:first-of-type {
  padding-right: 40px;
}

/* ---------------------------------------------------------------- friendlier parameter forms */

details.advanced > summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

details.advanced[open] > summary {
  margin-bottom: 10px;
}

.settings-head {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.list-field > small {
  margin-bottom: 6px;
}

.list-empty {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.row-advanced > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.row-advanced[open] > summary {
  margin-bottom: 6px;
}

.field > select + input {
  margin-top: 6px;
}

details.advanced > .field,
.row-advanced > .field {
  margin-bottom: 14px;
}

details.advanced > summary {
  list-style: none;
}

details.advanced > summary::-webkit-details-marker {
  display: none;
}

details.advanced > summary::before {
  content: '▸';
  display: inline-block;
  width: 12px;
  color: var(--muted);
  transition: transform 0.15s;
}

details.advanced[open] > summary::before {
  transform: rotate(90deg);
}

/* ---------------------------------------------------------------- data tables */

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.data-grid {
  max-height: none;
}

.data-grid td {
  padding: 2px 4px;
}

.data-grid input.cell {
  width: 100%;
  min-width: 120px;
  height: 30px;
  border-color: transparent;
  background: transparent;
}

.data-grid input.cell:hover:not([readonly]) {
  border-color: var(--border);
}

.data-grid input.cell:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.data-grid input.cell.num {
  text-align: right;
}

.data-grid input.invalid {
  border-color: var(--danger);
}

.data-grid .row-id,
.data-grid .row-meta {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.col-type {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.column-row {
  grid-template-columns: 1fr 130px 34px;
  align-items: center;
}

.data-grid td {
  vertical-align: middle;
}

/* ---------------------------------------------------------------- API keys */

.api-keys {
  display: grid;
  gap: 8px;
}

.key-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.key-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

code.secret-once {
  word-break: break-all;
  user-select: all;
}

.info-box .listening {
  color: var(--accent);
  font-weight: 600;
}

.info-box .spaced {
  margin-top: 8px;
}

/* ---------------------------------------------------------------- files in data views */

.files-cell {
  white-space: nowrap;
}

.file-chip {
  height: 26px;
  padding: 0 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
}

.file-chip small {
  color: var(--muted);
}

/* ---------------------------------------------------------------- paused executions */

.status.waiting {
  background: var(--accent-soft);
  color: var(--accent);
}

.node-status.waiting {
  fill: var(--accent);
}

.waiting-box {
  display: grid;
  gap: 6px;
  padding: 6px 10px 10px;
}

.node.waiting .node-body {
  stroke: var(--accent);
  stroke-dasharray: 6 3;
}

/* ---------------------------------------------------------------- expression preview */

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

select.insert-field {
  width: auto;
  max-width: 55%;
  height: 26px;
  padding: 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.expr-preview {
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--success-soft);
  color: var(--success);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.expr-preview.muted {
  background: var(--surface-2);
  color: var(--muted);
}

.expr-preview.error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Rows line up at the top, so a preview under one field doesn't shift its neighbours. */
.list-row:not(.stacked) {
  align-items: start;
}

.list-row:not(.stacked) > .icon {
  margin-top: 24px;
}

/* ---------------------------------------------------------------- sticky notes */

:root {
  --note-yellow: #fff4c2;
  --note-blue: #dcebff;
  --note-green: #dcf5e6;
  --note-pink: #ffe0ec;
  --note-purple: #ece6ff;
  --note-gray: #eceef2;
  --note-border: rgb(0 0 0 / 12%);
  --note-text: #2b2f3a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --note-yellow: #4a4220;
    --note-blue: #1f3350;
    --note-green: #1d3a2b;
    --note-pink: #48243a;
    --note-purple: #322a52;
    --note-gray: #2c3039;
    --note-border: rgb(255 255 255 / 12%);
    --note-text: #ecedf2;
  }
}

:root[data-theme='dark'] {
  --note-yellow: #4a4220;
  --note-blue: #1f3350;
  --note-green: #1d3a2b;
  --note-pink: #48243a;
  --note-purple: #322a52;
  --note-gray: #2c3039;
  --note-border: rgb(255 255 255 / 12%);
  --note-text: #ecedf2;
}

.sticky .sticky-body {
  fill: var(--note-yellow);
  stroke: var(--note-border);
  stroke-width: 1;
}

.sticky.blue .sticky-body { fill: var(--note-blue); }
.sticky.green .sticky-body { fill: var(--note-green); }
.sticky.pink .sticky-body { fill: var(--note-pink); }
.sticky.purple .sticky-body { fill: var(--note-purple); }
.sticky.gray .sticky-body { fill: var(--note-gray); }

.sticky.selected .sticky-body {
  stroke: var(--accent);
  stroke-width: 2;
}

.sticky {
  cursor: grab;
}

.sticky-text {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 12px 14px;
  color: var(--note-text);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: none;
}

.sticky-text.empty {
  opacity: 0.55;
  font-style: italic;
}

.sticky-resize {
  stroke: var(--note-text);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
  pointer-events: none;
}

.sticky-resize-hit {
  fill: transparent;
  cursor: nwse-resize;
}

.current-version {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
}

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

.rerun-row {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 6px 6px;
}

/* ---------------------------------------------------------------- app shell: sidebar + page */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100%;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 14px 10px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.sidebar .brand {
  padding: 4px 10px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.011em;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-2);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}

.nav-link.active .nav-icon {
  color: var(--accent);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group + .nav-group {
  margin-top: 16px;
}

.nav-group-name {
  padding: 0 10px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.sidebar-foot {
  margin-top: auto;
}

.sidebar-foot .account {
  width: 100%;
  justify-content: flex-start;
  height: 40px;
  max-width: none;
}

.page {
  width: 100%;
  max-width: 1040px;
  padding: 28px 40px 48px;
}

.page.page-wide {
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.page-title .back-link {
  margin-bottom: 4px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page .intro,
.page .page-intro {
  margin: 0 0 20px;
  max-width: 68ch;
}

/* ---------------------------------------------------------------- workflow list */

.wf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.wf-search {
  flex: 1 1 240px;
  max-width: 360px;
}

.chips {
  display: flex;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.chip .count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chip.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.chip.alert .count {
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
}

.wf-sort {
  width: auto;
  margin-left: auto;
}

.wf-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.wf-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
}

.wf-item + .wf-item {
  border-top: 1px solid var(--border);
}

.wf-item:hover {
  background: var(--surface-2);
}

.wf-link {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 8px 14px 18px;
  color: inherit;
  text-decoration: none;
}

.wf-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.live-dot.on {
  border-color: var(--success);
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.wf-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.wf-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}

.wf-link:hover .wf-title-text {
  color: var(--accent);
}

.wf-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.wf-sub .state {
  font-weight: 600;
}

.wf-sub .state.on {
  color: var(--success);
}

.wf-health {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.run-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rd {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 70%, var(--surface));
}

.rd-error {
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-soft);
}

.rd-waiting,
.rd-running {
  background: var(--warning);
}

.rd-canceled {
  background: var(--edge);
}

.last-run {
  font-size: 12.5px;
  white-space: nowrap;
  min-width: 112px;
  text-align: left;
}

.last-run.bad {
  color: var(--danger);
  font-weight: 600;
}

.last-run.wait {
  color: color-mix(in srgb, var(--warning) 75%, var(--text));
  font-weight: 600;
}

.row-menu {
  flex: none;
}

.list-status {
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.empty-state {
  max-width: 520px;
  padding: 40px 0;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.empty-state p {
  margin: 0 0 20px;
}

/* Older pages inside the new shell: lists keep their look, at the new width. */
.page .wf-list {
  max-width: none;
}

/* ---------------------------------------------------------------- shell on small screens */

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .side-nav {
    order: 3;
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
  }

  .nav-group {
    flex-direction: row;
    flex-wrap: wrap;
    max-width: 100%;
    margin: 0;
  }

  .nav-group-name {
    display: none;
  }

  .nav-link {
    flex: none;
    height: 34px;
  }

  .sidebar-foot {
    margin: 0 0 0 auto;
  }

  .page {
    padding: 20px 16px 40px;
  }

  .page-header {
    flex-wrap: wrap;
    align-items: center;
  }

  .wf-sort {
    margin-left: 0;
  }

  .wf-link {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .wf-health {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 820px) {
  /* The column may shrink below the nav's width; the nav row scrolls instead of widening the page. */
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .side-nav,
  .page {
    min-width: 0;
  }

  .side-nav {
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .chips {
    flex-wrap: wrap;
  }

  .wf-search {
    max-width: none;
  }
}

/* ---------------------------------------------------------------- other lists in the shell: same grouped style */

.page .wf-list {
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.page .wf-list > .wf-row {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 14px 12px 14px 18px;
}

.page .wf-list > .wf-row + .wf-row {
  border-top: 1px solid var(--border);
}

.page .wf-list > .wf-row:hover {
  background: var(--surface-2);
}

.page .wf-list .wf-name strong {
  font-size: 15px;
  font-weight: 600;
}

/* Destructive actions stay visible but quiet until you point at them. */
.page .wf-list .danger {
  color: var(--muted);
}

.page .wf-list .danger:hover,
.page .wf-list .danger:focus-visible {
  color: var(--danger);
}

.page .empty.card {
  border: 1px dashed var(--border);
  box-shadow: none;
  background: transparent;
  text-align: left;
  padding: 32px;
}

/* ---------------------------------------------------------------- AI Agent Studio */

/* Agent colours: mid-tone fills that carry white text in light and dark themes. */
.av-violet { --av: #7357f6; }
.av-blue { --av: #2f6fe0; }
.av-teal { --av: #0f8f8a; }
.av-green { --av: #2d8a3e; }
.av-amber { --av: #b7791f; }
.av-orange { --av: #d0571c; }
.av-rose { --av: #c93a6b; }
.av-slate { --av: #5b6478; }

.agent-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--av, #7357f6);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.agent-avatar.small {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 11.5px;
}

.agent-avatar.large {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 24px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--av) 18%, transparent);
}

.agent-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.agent-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.small {
  font-size: 12.5px;
}

.nowrap {
  white-space: nowrap;
}

.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar-stack .agent-avatar + .agent-avatar {
  margin-left: -6px;
  box-shadow: 0 0 0 2px var(--surface);
}

.avatar-stack .more {
  margin-left: 6px;
}

/* The designer: parts | board | details */

.studio .topbar .wf-title {
  max-width: 320px;
}

.ag-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 350px;
}

.ag-parts,
.ag-side {
  background: var(--surface);
  overflow: auto;
}

.ag-parts {
  border-right: 1px solid var(--border);
  overflow-x: hidden;
  padding: 16px 14px;
}

.ag-side {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ag-group + .ag-group {
  margin-top: 20px;
}

.ag-group h2 {
  font-size: 13px;
  margin: 0;
}

.ag-group > p {
  margin: 2px 0 8px;
}

.ag-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.ag-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: grab;
}

.ag-item:hover {
  border-color: var(--accent);
}

.ag-item:active {
  cursor: grabbing;
}

.ag-item-icon {
  width: 22px;
  text-align: center;
  color: var(--accent);
}

.ag-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  font-size: 13px;
}

.ag-item-text > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-none {
  margin: 0;
}

.link {
  border: none;
  background: none;
  padding: 0;
  height: auto;
  color: var(--accent);
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
}

.ag-stage {
  position: relative;
  overflow: hidden auto;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 20px 20px;
}

.ag-board {
  position: relative;
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 40px 24px;
  container-type: inline-size;
}

/* A narrow board stacks the parts around the agent. */
@container (max-width: 520px) {
  .ag-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'model' 'core' 'skills' 'memory' 'tools';
    gap: 28px;
  }
}

.ag-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ag-wires .wire {
  fill: none;
  stroke: var(--edge);
  stroke-width: 2;
}

.ag-wires .wire.on {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.ag-wires .wire.empty {
  stroke-dasharray: 4 5;
  opacity: 0.7;
}

.ag-grid {
  position: relative;
  display: grid;
  width: 100%;
  max-width: 760px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, 1fr);
  grid-template-areas:
    '. model .'
    'memory core tools'
    'skills skills skills';
  gap: 56px clamp(28px, 6cqi, 72px);
  align-items: center;
}

.cell-model { grid-area: model; }
.cell-memory { grid-area: memory; }
.cell-core { grid-area: core; }

.cell-skills {
  grid-area: skills;
  display: grid;
  gap: 10px;
}

.cell-tools {
  grid-area: tools;
  display: grid;
  gap: 10px;
}

.ag-core,
.ag-part,
.ag-slot {
  border-radius: 12px;
  background: var(--surface);
}

.ag-core-main {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  font: inherit;
}

.ag-core-main strong {
  font-size: 16px;
}

.ag-core-main small {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ag-core.selected .ag-core-main,
.ag-part.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ag-part {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.ag-part-main {
  flex: 1;
  min-width: 0;
  height: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px 10px 10px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
}

.ag-part-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}

.ag-part-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ag-part-text strong,
.ag-part-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-remove {
  margin-right: 4px;
}

.ag-slot {
  display: grid;
  place-items: center;
  min-height: 52px;
  padding: 10px 12px;
  border: 1.5px dashed var(--border);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

/* While a part is dragged, the place it will go lights up. */
.dragging-model .ag-slot.kind-model,
.dragging-memory .ag-slot.kind-memory,
.dragging-tool .ag-slot.kind-tool,
.dragging-skill .ag-slot.kind-skill,
.dragging-model .ag-part.kind-model,
.dragging-memory .ag-part.kind-memory {
  border-color: var(--accent);
  border-style: dashed;
  background: var(--accent-soft);
  color: var(--accent);
}

.ag-side .tabs {
  margin: 12px 16px 0;
  align-self: flex-start;
}

.ag-side-body {
  flex: 1;
  min-height: 0;
  padding: 12px 16px 16px;
  overflow: auto;
}

.ag-side-body > .field,
.ag-side-body > details {
  margin-bottom: 14px;
}

.ag-side-body h2 {
  font-size: 15px;
  margin: 4px 0 10px;
}

.ag-side-body.chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 12px;
}

.swatches {
  display: flex;
  gap: 6px;
}

.swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 7px;
  border: 2px solid transparent;
  background: var(--av);
}

.swatch.on {
  border-color: var(--text);
  box-shadow: inset 0 0 0 2px var(--surface);
}

/* Test chat */

.chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 4px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-hint {
  font-size: 13px;
}

.msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 100%;
}

.msg.user {
  justify-content: flex-end;
}

.msg .bubble {
  max-width: 86%;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.msg.user .bubble {
  background: var(--accent-fill);
  color: var(--accent-text);
  border-bottom-right-radius: 4px;
}

.msg.assistant .bubble {
  border-bottom-left-radius: 4px;
}

.msg.error .bubble {
  background: var(--danger-soft);
  color: var(--danger);
}

.msg .bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.msg .bubble pre {
  margin: 4px 0 0;
  font: 12px/1.4 var(--mono);
  white-space: pre-wrap;
}

.msg .steps {
  margin-top: 6px;
  font-size: 12.5px;
}

.msg .steps ol {
  padding-left: 18px;
  margin: 4px 0 0;
}

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1s infinite ease-in-out;
}

.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.chat-input {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.chat-input textarea {
  resize: vertical;
  min-height: 44px;
}

.chat-input .row {
  justify-content: space-between;
}

/* AI Workspaces */

.title-input {
  font: inherit;
  border: 1px solid transparent;
  background: transparent;
  padding: 0 4px;
  margin-left: -5px;
  width: 100%;
  max-width: 600px;
  border-radius: 6px;
  color: inherit;
}

.title-input:hover,
.title-input:focus {
  border-color: var(--border);
}

.ws-description {
  width: 100%;
  max-width: 720px;
  margin-bottom: 16px;
  resize: vertical;
}

.ws-columns {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

.ws-section {
  padding: 16px 18px;
}

.ws-section h2 {
  font-size: 15px;
  margin: 0 0 12px;
}

.ws-members {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ws-member {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) minmax(110px, 1fr) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ws-agent {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-field {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ws-field input,
.ws-field select {
  min-width: 0;
  width: 100%;
}

.ws-add {
  gap: 8px;
  flex-wrap: wrap;
}

.tree,
.tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree ul {
  margin-left: 11px;
  padding-left: 18px;
  border-left: 1.5px solid var(--border);
}

.tree li {
  padding: 4px 0;
}

.ws-node {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 1100px) {
  .ag-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .ag-side {
    grid-column: 1 / -1;
    border-left: none;
    border-top: 1px solid var(--border);
    min-height: 420px;
  }

  .studio {
    height: auto;
    min-height: 100%;
  }
}

@media (max-width: 820px) {
  .ag-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ag-parts {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .ag-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'model' 'core' 'skills' 'memory' 'tools';
    gap: 28px;
  }

  .ws-columns,
  .ws-member {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing i {
    animation: none;
  }
}

/* ---------------------------------------------------------------- AI Workspace: board and team */

.agent-avatar.tiny {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 9.5px;
}

.ws-tabs {
  margin: 4px 0 16px;
}

.notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warning) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border));
  font-size: 13.5px;
}

.ws-composer {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.ws-composer input[type='text'] {
  font-size: 15px;
  height: 40px;
}

.ws-composer textarea {
  resize: vertical;
}

.ws-composer-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.ws-assign {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ws-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.ws-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
}

.ws-chip.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.busy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
}

.ws-kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.ws-col {
  min-height: 140px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1.5px dashed transparent;
}

.ws-kanban.dragging .col-working {
  border-color: var(--accent);
}

.ws-col.over {
  background: var(--accent-soft);
}

.ws-col h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 4px 10px;
  font-size: 13px;
}

.ws-col h3 .count {
  font-weight: 500;
  color: var(--muted);
}

.ws-col-empty {
  margin: 4px;
}

.ws-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ws-card {
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.ws-card[draggable='true'] {
  cursor: grab;
}

.ws-card.st-working {
  border-color: color-mix(in srgb, var(--warning) 60%, var(--border));
}

.ws-card.st-failed {
  border-left: 3px solid var(--danger);
}

.ws-card-main {
  width: 100%;
  height: auto;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
}

.ws-card-title {
  font-weight: 600;
  font-size: 13.5px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.ws-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.ws-handoffs {
  display: flex;
  gap: 4px;
}

.handoff {
  position: relative;
}

.handoff.st-working .agent-avatar {
  outline: 2px solid var(--warning);
}

.handoff.st-failed .agent-avatar {
  outline: 2px solid var(--danger);
}

.pill.st-todo { background: var(--surface-2); color: var(--muted); }
.pill.st-working { background: color-mix(in srgb, var(--warning) 18%, var(--surface)); color: color-mix(in srgb, var(--warning) 70%, var(--text)); }
.pill.st-done { background: var(--success-soft); color: var(--success); }
.pill.st-failed { background: var(--danger-soft); color: var(--danger); }

.task-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.task-body {
  display: grid;
  gap: 12px;
}

.task-body > .pill {
  justify-self: start;
  margin: 0;
}

.task-body h3 {
  font-size: 13.5px;
  margin: 4px 0 6px;
}

.task-details,
.task-result {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-result {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

.handoff-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.handoff-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.handoff-head .pill {
  margin-left: auto;
}

/* The org chart: top-down, with connecting lines. */

.ws-team-view {
  display: grid;
  gap: 16px;
}

.org {
  overflow-x: auto;
  padding-bottom: 8px;
}

.org-top {
  margin: 0 auto 4px;
  max-width: 340px;
  padding: 8px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  visibility: hidden;
}

.org.dragging .org-top {
  visibility: visible;
}

.org-top.over,
.org-card.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.org ul {
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 18px 0 0;
  list-style: none;
  position: relative;
}

.org > .org-tree {
  padding-top: 0;
}

.org li {
  position: relative;
  padding: 18px 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.org > .org-tree > li {
  padding-top: 0;
}

/* Lines: a horizontal rail across siblings, a stem down to each card, and one down from each parent. */
.org li::before,
.org li::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 18px;
  border-top: 1.5px solid var(--edge);
}

.org li::before { right: 50%; }
.org li::after { left: 50%; border-left: 1.5px solid var(--edge); }
.org li:first-child::before,
.org li:last-child::after { border-top: none; }
.org li:only-child::before { display: none; }
.org li:only-child::after { border-top: none; }
.org > .org-tree > li::before,
.org > .org-tree > li::after { display: none; }

.org ul ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  height: 18px;
  border-left: 1.5px solid var(--edge);
}

.org-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  max-width: 220px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.org-card[draggable='true'] {
  cursor: grab;
}

.org-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.org-text strong,
.org-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-hint {
  text-align: center;
  margin: 12px 0 0;
}

@media (max-width: 1000px) {
  .ws-kanban {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .ws-kanban {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ws-description {
  display: block;
}

.ws-tabs {
  display: flex;
  width: max-content;
}

h1 .title-input {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
  height: auto;
}

h1 .title-input:hover,
h1 .title-input:focus {
  border-color: var(--border);
  background: var(--surface);
}

.ws-assign {
  white-space: nowrap;
}

.handoff-list .handoff-list {
  margin: 8px 0 0 11px;
  padding-left: 16px;
  border-left: 1.5px solid var(--border);
}

.ag-item-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ag-cell {
  min-width: 0;
}

/* Scheduled tasks on the AI Workspace board */

.ws-scheduled {
  padding: 12px 16px;
  margin-bottom: 14px;
}

.ws-sched-head h2 {
  font-size: 14px;
  margin: 0;
}

.ws-scheduled > p {
  margin: 6px 0 2px;
}

.ws-sched-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
}

.ws-sched {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.ws-sched + .ws-sched {
  border-top: 1px solid var(--border);
}

.ws-sched.paused .ws-sched-main strong {
  color: var(--muted);
}

.ws-sched-main {
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 2px 4px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
}

.ws-sched-main strong,
.ws-sched-main span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-sched-when {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tag {
  justify-self: start;
  padding: 0 7px;
  font-size: 11.5px;
  line-height: 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sched-when {
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.sched-when .field {
  margin: 0;
}

.sched-when .grow {
  flex: 1;
  min-width: 180px;
}

@media (max-width: 600px) {
  .ws-sched {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .ws-sched-when {
    grid-column: 2;
  }
}

.sched-when input[type='time'],
.sched-when input[type='number'] {
  width: 130px;
}

/* Agent look and personality */

.agent-avatar.has-icon {
  font-size: 17px;
}

.agent-avatar.small.has-icon { font-size: 13px; }
.agent-avatar.tiny.has-icon { font-size: 10px; }
.agent-avatar.large.has-icon { font-size: 30px; }

.look {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.look-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.look-preview > span {
  display: flex;
  flex-direction: column;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 4px;
}

.icon-pick {
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 17px;
  line-height: 1;
}

.icon-pick:hover {
  border-color: var(--border);
}

.icon-pick.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.swatches {
  flex-wrap: wrap;
  align-items: center;
}

.swatch-custom {
  width: 30px;
  height: 26px;
  padding: 0;
  border: 1px dashed var(--border);
  border-radius: 7px;
  background: none;
  cursor: pointer;
}

.look select + textarea {
  margin-top: 6px;
}

/* AI Workspace: team chat */

.tc-card {
  display: flex;
  flex-direction: column;
  height: min(70vh, 720px);
  min-height: 420px;
  padding: 0;
  overflow: hidden;
}

.tc-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tc-empty {
  margin: auto;
  max-width: 460px;
  text-align: center;
}

.tc-msg {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.person-avatar {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.tc-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.tc-text {
  margin: 2px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 72ch;
}

.tc-msg.error .tc-text {
  color: var(--danger);
}

.tc-hands {
  margin-top: 6px;
  font-size: 13px;
}

.tc-hands ol {
  margin: 6px 0 0;
  padding-left: 18px;
}

.tc-hands p {
  margin: 2px 0 6px;
  white-space: pre-wrap;
}

.proposal {
  margin-top: 8px;
  max-width: 560px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface));
}

.proposal ul {
  margin: 6px 0 10px;
  padding-left: 18px;
}

.proposal .row {
  gap: 8px;
}

.proposal.st-applied {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
  background: var(--success-soft);
}

.proposal.st-dismissed {
  opacity: 0.7;
  background: var(--surface-2);
  border-color: var(--border);
}

.proposal p {
  margin: 0;
}

.tc-compose {
  display: grid;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.tc-compose textarea {
  resize: vertical;
}

.tc-compose .row {
  gap: 10px;
}

.tc-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tc-chips .ws-chip {
  height: auto;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.tc-chips .ws-chip:hover {
  border-color: var(--accent);
}

/* AI Workspace: the office */

.office {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
  gap: 16px;
  align-items: start;
}

.office-card {
  padding: 8px;
  overflow: hidden;
}

.office-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 480 / 300;
  border-radius: 8px;
  image-rendering: pixelated;
  cursor: pointer;
}

.office-canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.office-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .office {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Team chat, messaging-app layout: conversations | thread */

.tc {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  height: min(74vh, 760px);
  min-height: 460px;
  padding: 0;
  overflow: hidden;
}

.tc-side {
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  overflow: auto;
  padding: 10px 8px;
}

.tc-side-title {
  margin: 16px 10px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.tc-convs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.tc-conv {
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font: inherit;
}

.tc-conv:hover {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.tc-conv.active {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tc-conv-text {
  display: grid;
  min-width: 0;
}

.tc-conv-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.tc-conv-top strong,
.tc-conv-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-conv-top time {
  flex: none;
  font-size: 11.5px;
}

.tc-conv-preview {
  font-size: 12.5px;
}

.tc-hash {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  font-size: 16px;
}

.tc-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.tc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.tc-head-text {
  min-width: 0;
}

.tc-head h2 {
  margin: 0;
  font-size: 15px;
}

.tc-head p {
  margin: 1px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc .tc-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 8px 0 12px;
  display: block;
}

.tc .tc-msg {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 6px 18px 2px;
}

.tc .tc-msg.grouped {
  padding-top: 1px;
}

.tc .tc-msg:hover {
  background: var(--surface-2);
}

.tc .tc-msg.sending {
  opacity: 0.6;
}

.tc-hover-time {
  visibility: hidden;
  font-size: 10.5px;
  text-align: right;
  padding-top: 3px;
}

.tc-msg:hover .tc-hover-time {
  visibility: visible;
}

.tc .tc-text {
  margin: 0;
}

.tc-day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 18px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.tc-day::before,
.tc-day::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--border);
}

.tc-loading,
.tc-start {
  text-align: center;
  padding: 10px 18px;
}

.tc .tc-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 420px;
  margin: 60px auto 0;
  text-align: center;
}

.tc .tc-empty p {
  margin: 0;
}

.tc-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 14px 14px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.tc-compose:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tc-compose textarea {
  flex: 1;
  overflow-y: hidden;
  min-height: 36px;
  max-height: 160px;
  resize: none;
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 8px 6px;
}

.tc-compose textarea:focus {
  outline: none;
  box-shadow: none;
}

.tc-readonly {
  margin: 0 18px 14px;
}

@media (max-width: 760px) {
  .tc {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: 80vh;
  }

  .tc-side {
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px;
  }

  .tc-side-title {
    display: none;
  }

  .tc-convs {
    display: flex;
  }

  .tc-conv {
    grid-template-columns: 28px auto;
    white-space: nowrap;
  }

  .tc-conv-preview,
  .tc-conv-top time {
    display: none;
  }
}

/* Studio tools, by category */

.ag-tool-search {
  margin: 2px 0 8px;
}

.ag-cats {
  display: grid;
  gap: 4px;
}

.ag-cat > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}

.ag-cat > summary::-webkit-details-marker {
  display: none;
}

.ag-cat > summary::before {
  content: '▸';
  color: var(--muted);
  font-size: 11px;
  margin-right: 2px;
}

.ag-cat[open] > summary::before {
  content: '▾';
}

.ag-cat > summary span:first-child {
  flex: 1;
}

.ag-cat > summary:hover {
  background: var(--surface-2);
}

.ag-cat > summary .count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
}

.ag-cat > .ag-items,
.ag-cat > .ag-none {
  margin: 4px 0 8px;
}

/* ---------------------------------------------------------------- tool inventory and skills */

.ag-part.kind-skill .ag-part-icon {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--text);
}

.tool-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.tool-badge.inline {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 13px;
  vertical-align: middle;
}

.with-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog.wide {
  width: min(640px, 100%);
}

.tool-pick-list {
  display: grid;
  gap: 14px;
  max-height: min(60vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.tool-pick-cat h3 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.tool-pick-cat ul,
.skill-examples,
.skill-tools ul,
ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.tool-pick-cat ul {
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
}

.tool-pick,
.skill-example {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  font: inherit;
}

.tool-pick:hover,
.skill-example:hover:not(:disabled) {
  border-color: var(--accent);
}

.tool-pick small,
.skill-example small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-examples {
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  margin: 12px 0 16px;
  text-align: left;
}

.skill-more {
  margin-top: 18px;
}

.skill-more summary {
  cursor: pointer;
  color: var(--muted);
}

.tool-form {
  display: grid;
  gap: 14px;
}

.tool-form .dialog-actions {
  align-items: center;
}

.tool-try {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.tool-try h3 {
  margin: 0;
  font-size: 14px;
}

.tool-try p {
  margin: 0;
}

.tool-result pre,
.skill-text {
  max-height: 240px;
  overflow: auto;
  margin: 4px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.skill-tools label.check {
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-to-tools {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* A whole row that opens something: left-aligned like a list item, not a centred link. */
button.agent-link {
  flex: 1;
  height: auto;
  justify-content: flex-start;
  padding: 0;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  font: inherit;
}

button.agent-link:hover strong {
  color: var(--accent);
}

.tool-pick,
.skill-example {
  white-space: normal;
}

.tool-try p,
.tool-dialog .tool-open {
  padding: 0;
}

.tool-pick,
.skill-example {
  justify-content: flex-start;
}

.tool-pick *,
.skill-example * {
  white-space: normal;
}

.cell-tools > *,
.cell-skills > * {
  min-width: 0;
}

.cell-skills {
  justify-items: center;
}

.cell-skills > * {
  width: min(300px, 100%);
}

/* ---------------------------------------------------------------- agent page, simple view */

.ag-host {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ag-simple {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
}

.ag-form-wrap {
  min-height: 0;
  overflow: auto;
  background: var(--bg);
}

.ag-form {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  display: grid;
  gap: 16px;
}

.ag-starters h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.ag-starters ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 8px;
}

.ag-sec {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 8px 28px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.ag-sec-head h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.ag-sec-head p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.ag-sec-body {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.ag-sec-body > .field {
  margin: 0;
}

.ag-sec-body textarea {
  min-height: 120px;
}

.ag-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ag-chip {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.ag-chip.problem {
  border-color: var(--warning);
}

.ag-chip-main {
  flex: 1;
  min-width: 0;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  white-space: normal;
}

.ag-chip-main:hover strong {
  color: var(--accent);
}

.ag-chip-main small {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ag-chip.problem small {
  color: var(--text);
}

.ag-chip > .icon {
  margin-right: 6px;
}

.ag-add {
  justify-self: start;
}

.ag-empty p {
  margin: 0 0 10px;
}

.ag-switch {
  gap: 10px;
}

.ag-look summary,
.ag-limits summary {
  cursor: pointer;
}

.ag-limits {
  padding: 0 4px;
}

.ag-try {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 12px;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.ag-try-head {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.ag-try-head h2 {
  margin: 0;
  font-size: 15px;
}

.ag-dialog-body {
  display: grid;
  gap: 12px;
}

.ag-dialog-body > h2 {
  display: none;
}

.ag-view {
  margin-right: 4px;
}

@media (max-width: 900px) {
  .ag-simple {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    overflow: auto;
  }

  .ag-form-wrap {
    overflow: visible;
  }

  .ag-try {
    min-height: 420px;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .ag-sec {
    grid-template-columns: minmax(0, 1fr);
  }

  .ag-try-btn {
    display: none;
  }
}

/* The section title already names it; the label stays for screen readers. */
.ag-instructions .field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Agent pictures: an uploaded image fills the avatar. */
.agent-avatar.has-picture { padding: 0; overflow: hidden; background: var(--surface-2, #eee); }
.agent-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picture-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.picture-row small { flex-basis: 100%; }

/* Templates: a grid of cards on the empty Workflows page and in the New workflow dialog. */
.templates { margin-top: 32px; }
.templates h2 { font-size: 15px; margin: 0 0 12px; }
.template-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.template-card {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; height: 100%; text-align: left;
  padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  font: inherit; white-space: normal; justify-content: flex-start; cursor: pointer;
}
.template-card:hover { border-color: var(--accent); }
.template-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.template-icon {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.template-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.template-text .muted { font-size: 13px; line-height: 1.4; }
.template-needs { color: var(--muted); font-size: 12px; }
.new-wf-dialog { max-height: 86vh; overflow: auto; }
.new-wf-dialog .template-card.blank { margin-top: 4px; }
.new-wf-dialog .templates { margin-top: 20px; }

/* Test connection result in the credential dialog. */
.test-result { margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 13px; background: var(--surface-2); color: var(--muted); }
.test-result.ok { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.test-result.bad { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.dialog-actions .spacer { flex: 1; }

/* Variables page */
.var-add, .var-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 8px; align-items: center; }
.var-add { margin: 16px 0; max-width: 820px; }
.var-list { list-style: none; margin: 0; padding: 0; max-width: 820px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.var-row { padding: 8px 12px; }
.var-row + .var-row { border-top: 1px solid var(--border); }
.var-key { justify-content: flex-start; background: none; border: 0; padding: 4px 0; cursor: copy; min-width: 0; overflow: hidden; }
.var-key code { color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .var-add, .var-row { grid-template-columns: 1fr auto; } .var-add input:first-child, .var-row .var-key { grid-column: 1 / -1; } }

.exec-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }

/* Keyboard shortcuts dialog */
.shortcuts-dialog { width: min(560px, calc(100vw - 32px)); }
.shortcuts-dialog section + section { margin-top: 14px; }
.shortcuts-dialog h3 { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 0 0 6px; }
.shortcuts-dialog dl { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; margin: 0; align-items: center; }
.shortcuts-dialog dt { white-space: nowrap; color: var(--muted); font-size: 12px; }
.shortcuts-dialog dd { margin: 0; font-size: 13.5px; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; margin-right: 3px; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); color: var(--text);
  font: 600 11.5px/1.5 var(--mono); text-align: center;
}

/* ---------------------------------------------------------------- polish: focus, empty states, tables, motion */

::placeholder {
  color: var(--muted);
  opacity: 1;
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--accent-fill);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 8px;
  z-index: 40;
  transform: translateY(-140%);
  background: var(--accent-fill);
  color: var(--accent-text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  transform: none;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.busy-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 100%;
  height: 2px;
  background: var(--accent-fill);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0;
  pointer-events: none;
}

html.busy .busy-bar {
  opacity: 1;
  animation: busy-slide 1.1s ease-in-out infinite;
}

@keyframes busy-slide {
  0% { transform: translateX(-40%) scaleX(0.35); }
  50% { transform: translateX(30%) scaleX(0.45); }
  100% { transform: translateX(110%) scaleX(0.35); }
}

.login {
  justify-items: stretch;
}

.login .field {
  width: 100%;
}

.login .warn {
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
}

.dialog-actions {
  flex-wrap: wrap;
}

.page-actions .danger,
.drawer .danger {
  color: var(--muted);
}

.page-actions .danger:hover,
.page-actions .danger:focus-visible,
.drawer .danger:hover,
.drawer .danger:focus-visible {
  color: var(--danger);
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -16px -16px 0;
  padding: 16px 16px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.drawer-empty {
  display: grid;
  gap: 6px;
  padding: 12px 2px;
}

.drawer-empty p {
  margin: 0;
}

.palette-hint,
.palette-empty {
  margin: 2px 2px 8px;
  font-size: 12.5px;
}

.list-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

.data-grid tbody tr:hover td {
  background: transparent;
}

.error-box strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font);
  font-size: 13px;
}

.error-box span {
  font-family: var(--mono);
}

.pill.warn,
.pill.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill.wait {
  background: var(--warning-soft);
  color: color-mix(in srgb, var(--warning) 80%, var(--text));
}

.tab {
  height: 30px;
  padding: 0 12px;
}

.ws-composer h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.office-hint {
  margin: 0;
  padding: 8px 12px 10px;
  font-size: 12.5px;
}

.notice {
  background: var(--warning-soft);
}

@media (max-width: 820px) {
  .side-nav {
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 2px;
    scroll-padding-inline: 8px;
  }

  .nav-group {
    flex-wrap: wrap;
    max-width: 100%;
  }

  .nav-group + .nav-group {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .shortcuts-dialog dl {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .shortcuts-dialog dd {
    margin-bottom: 8px;
  }

  .ndv-head {
    flex-wrap: wrap;
  }

  .dialog {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.busy .busy-bar {
    animation: none;
    transform: scaleX(1);
  }
}
