/* Workflow Platform. Component styles; design decisions live in DESIGN.md. */

* { box-sizing: border-box; }

[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font-ui); color: var(--ink); background: var(--bg) linear-gradient(125deg, var(--bg-edge), var(--bg) 55%, var(--bg-edge)); line-height: 1.5; font-size: 14px; -webkit-font-smoothing: antialiased; }
.glass { background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--shadow-md), inset 0 1px 0 var(--rim); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)); backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat)); }

.shell { display: block; min-height: 100vh; }

#center { position: relative; min-width: 0; height: 100vh; }

#sidebar { position: fixed; inset: 16px auto 16px 16px; width: var(--sidebar-w); border-radius: var(--radius-lg); padding: 20px 12px 12px; display: flex; flex-direction: column; overflow: hidden; z-index: 40; }
.brand { font-weight: 600; font-size: 15px; letter-spacing: -.025em; display: flex; align-items: center; gap: 10px; padding: 2px 10px 20px; color: var(--ink); text-decoration: none; }
.wf-section-label { margin: 24px 12px 8px; color: var(--gray-500); font-size: 12px; font-weight: 500; }
.wf-components { margin-top: 24px; border-top: 1px solid var(--gray-200); padding-top: 14px; }
.wf-components summary { cursor: pointer; color: var(--gray-600); font-size: 12px; font-weight: 500; padding: 8px 12px; border-radius: 7px; }
.wf-components summary:hover { background: var(--gray-100); }
.wf-components summary span { font-weight: 400; color: var(--gray-500); }
.wf-components > .wf-nav { margin-top: var(--space-2); }
.wf-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.wf-nav a { display: block; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: var(--gray-700); font-size: 13px; cursor: pointer; }
.wf-nav a:hover { background: var(--gray-100); color: var(--ink); }
.wf-nav a.active { background: var(--surface-solid); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px var(--shadow-color), inset 0 1px 0 var(--rim); }

.wf-name { display: block; overflow-wrap: anywhere; white-space: normal; line-height: 1.45; }
.wf-ref { display: block; font-size: 12px; color: var(--gray-500);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv-head-icon { margin-right: 6px; color: var(--gray-500); }

a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm);
}

.center-empty { display: grid; place-items: center; height: 60vh; color: var(--gray-500); }

#drawer:empty { display: none; }

.wf-header { position: absolute; top: 16px; left: calc(var(--sidebar-w) + 32px); right: 16px; max-width: none; min-height: 114px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 20px 24px 16px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; border-bottom: 1px solid var(--gray-200); box-shadow: inset 0 1px 0 var(--rim); z-index: 30; }
.wf-header h1 { font-size: 22px; font-weight: 550; letter-spacing: -.035em; line-height: 1.25; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.hdr-run { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 15px; border: 1px solid var(--primary-border); border-radius: 7px; background: var(--primary) linear-gradient(var(--primary-top), var(--primary)); box-shadow: inset 0 1px 0 var(--primary-rim), 0 1px 2px var(--shadow-color); color: var(--on-primary); font: 500 13px var(--font-ui); cursor: pointer; white-space: nowrap; }
.hdr-run:hover { filter: brightness(1.06); }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-500); white-space: nowrap; max-width: 100%; overflow: auto; }
.crumbs a { color: var(--gray-700); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumb-current { color: var(--ink); font-weight: 600; }

.crumb-sep { color: var(--gray-500); }

.used-by { font-size: var(--text-sm); color: var(--gray-500); white-space: nowrap; }
.used-by a { color: var(--accent); text-decoration: none; }
.used-by a:hover { text-decoration: underline; }
.used-by-step { color: var(--gray-500); margin-left: 4px; }
.definition-notice { margin: 0; font-size: var(--text-sm); color: var(--gray-700); line-height: 1.4; overflow-wrap: anywhere; }

.graph { padding: 0; position: absolute; inset: 16px 16px 16px calc(var(--sidebar-w) + 32px); z-index: 0; overflow: hidden; cursor: grab; touch-action: none; border-radius: var(--radius-lg); background: var(--canvas); border: 1px solid var(--gray-200); }
.graph.panning { cursor: grabbing; user-select: none; }
.graph-canvas { position: absolute; top: 0; left: 0; padding: 20px; transform-origin: 0 0; will-change: transform; }

.chain { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: nowrap;
  align-items: center; gap: var(--space-4) 60px; position: relative; z-index: 1; }
.cube { position: relative; display: flex; flex-direction: column; gap: 12px; width: 196px; min-height: 112px; box-sizing: border-box; flex: 0 0 auto; padding: 16px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--node-border); box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .16s var(--ease), box-shadow .16s var(--ease); }
.cube:hover { border-color: var(--gray-400); box-shadow: 0 3px 8px var(--shadow-color); }
.cube.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak), 0 6px 18px var(--shadow-color); }

.cube-workflow { border-style: solid; }
.cube-workflow .cube-icon { color: var(--gray-600); }
.drill-link { position: absolute; top: 9px; right: 9px; text-decoration: none; color: var(--gray-500); border-radius: 5px; width: 30px; height: 30px; display: grid; place-items: center; transition: color .15s var(--ease), background .15s var(--ease); }
.drill-link:hover { color: var(--accent); background: var(--accent-weak); }

.graph-connectors { position: absolute; top: 0; left: 0; pointer-events: none;
  z-index: 0; overflow: visible; }
.graph-connectors path { fill: none; stroke: var(--connector); stroke-width: 1.2; }
.cube-icon { display: inline-flex; width: 18px; height: 18px; align-items: center; color: var(--gray-600); }
.cube-id { font-size: 13px; font-weight: 500; min-width: 0; font-family: var(--font-code); letter-spacing: -.02em; overflow-wrap: anywhere; line-height: 1.45; }
.cube-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--gray-400); }
.cube-done { border-color: var(--node-border); }
.cube-done   .cube-dot { background: var(--ok); }
.cube-failed { border-color: var(--err); }
.cube-failed .cube-dot { background: var(--err); }
.cube-running .cube-dot { background: var(--accent); }

.secret-badge { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; border-radius: 50%;
  border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); }

.secret-missing { background: var(--warn-weak); border-color: var(--err);
  color: var(--warn-ink); }

.store-banner { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--warn); border-radius: var(--radius-sm);
  background: var(--warn-weak); color: var(--warn-ink); line-height: 1.5; }
.secret-set { background: var(--gray-100); border-color: var(--gray-300);
  color: var(--gray-500); }
.secret-section-head { margin-top: var(--space-3); }
.secret-msg { margin: var(--space-1) 0; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm); font-size: var(--text-sm); }

.secret-msg-ok { background: rgba(22,163,74,.12); color: var(--ok-ink); }
.secret-msg-err { background: rgba(220,38,38,.10); color: var(--err-ink); }
.secret-msg-info { background: var(--gray-100); color: var(--gray-700); }

#modal:empty { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--scrim); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); padding: 24px; }
.modal-panel { width: min(860px, 96vw); max-height: 90vh; display: flex; flex-direction: column; border-radius: 18px; padding: 0; overflow: hidden; background: var(--surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--gray-200); flex-shrink: 0; }
.modal-title { font-size: 13px; font-weight: 500; color: var(--gray-600); overflow-wrap: anywhere; }
.modal-body { overflow: auto; padding: 28px 44px 40px; overscroll-behavior: contain; }

.chip-open { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin: 4px 0; padding: 8px 12px; min-height: 36px; border: 1px solid var(--gray-300); border-radius: 7px; background: var(--surface-solid); color: var(--ink); font: 500 13px var(--font-ui); cursor: pointer; text-decoration: none; overflow-wrap: anywhere; }
.chip-open:hover { border-color: var(--accent); color: var(--accent-ink); }
.drill-chip { justify-content: flex-start; width: 100%; color: var(--gray-700); font-size: 12px; text-align: left; }
.chip-preview { display: block; color: var(--gray-500); font-size: var(--text-sm); margin: var(--space-1) 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.prompt-hint { font-weight: 400; font-size: var(--text-sm); color: var(--gray-500); }
.prompt-edit { width: 100%; padding: var(--space-2); border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); background: var(--surface-solid); font-size: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5;
  resize: vertical; margin-bottom: var(--space-2); }
.prompt-edit:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }

#drawer { position: fixed; top: var(--drawer-top, 146px); right: 28px; bottom: 28px; width: min(384px, 90vw); border-radius: 12px; padding: 22px; overflow: auto; z-index: 25; background: var(--panel); transition: opacity .16s var(--ease); }
.drawer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.drawer-head .cube-icon { font-size: 1.3rem; }
.drawer-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.drawer-close { margin-left: auto; flex: 0 0 32px; border: 0; background: transparent; cursor: pointer; width: 32px; height: 32px; border-radius: 6px; color: var(--gray-600); font: 22px var(--font-ui); display: grid; place-items: center; }
.kv { margin: var(--space-2) 0; }
.kv-key { font-size: var(--text-sm); color: var(--gray-500); }
.kv-val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-sm);
  white-space: pre-wrap; word-break: break-word; }
.kv-head { font-size: var(--text-sm); font-weight: 600; color: var(--gray-700);
  margin: var(--space-3) 0 var(--space-1); }
.kv-sub { display: flex; gap: var(--space-3);
  margin: var(--space-1) 0 var(--space-1) var(--space-3); }
.kv-sub .kv-key { min-width: 76px; flex: none; }
.kv-text { margin-top: var(--space-1); }

.dep-list { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-2); }
.dep-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem; color: var(--accent-ink); background: var(--accent-weak);
  border-radius: 999px; padding: 2px var(--space-2); white-space: nowrap; }
.field { display: block; margin: var(--space-3) 0; }
.field span { display: block; font-size: var(--text-sm); color: var(--gray-700);
  margin-bottom: var(--space-1); }
.field input, .field select, .field textarea { width: 100%; padding: var(--space-2); border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); background: var(--glass-bg); color: var(--ink); font-size: var(--text-md); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
.field textarea { resize: vertical; }
.field .input-hint { white-space: normal; margin-top: 4px; font-size: 12px; line-height: 1.4; }
.btn-run { min-height: 38px; padding: 9px 16px; border: 1px solid var(--primary-border); border-radius: 7px; background: var(--primary) linear-gradient(var(--primary-top), var(--primary)); color: var(--on-primary); box-shadow: inset 0 1px 0 var(--primary-rim); font: 500 14px var(--font-ui); cursor: pointer; }
.btn-run > .icon { width: 14px; height: 14px; vertical-align: -2px; margin-left: 4px; }
.btn-run:hover { filter: brightness(1.05); }
.drawer-state { font-size: var(--text-sm); color: var(--gray-500); }

.drawer-error { margin: var(--space-2) 0; padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm); background: rgba(220,38,38,.10); color: var(--err-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-sm);
  white-space: pre-wrap; word-break: break-word; }

.drawer-error a { color: inherit; text-decoration: underline; }
.err { color: var(--err); }

#run-status:empty { display: none; }

.badge { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 3px 8px; border-radius: 5px; font-size: 12px; line-height: 1.6; font-weight: 500; background: var(--gray-100); color: var(--gray-700); white-space: nowrap; }
.badge-running { background: var(--accent-weak); color: var(--accent-ink); }
.badge-completed { background: rgba(22,163,74,.14); color: var(--ok-ink); }
.badge-failed { background: rgba(220,38,38,.12); color: var(--err-ink); }
.status-completed { color: var(--ok); } .status-failed { color: var(--err); }
.status-running { color: var(--accent); } .status-pending { color: var(--gray-500); }

.cube-running { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .cube-running { animation: none; } }
.cube-waiting_manual { border-color: var(--warn); }
.cube-waiting_manual .cube-dot { background: var(--warn); }
.badge-waiting_manual { background: var(--warn-weak); color: var(--warn-ink); }

.badge-cancelled, .badge-timed_out { background: var(--gray-100); color: var(--gray-700); }

.graph-controls { position: absolute; z-index: 2; bottom: 30px; left: calc(var(--sidebar-w) + 48px); display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 9px; }
.gc-btn { width: 34px; height: 34px; border: 0; border-radius: 5px; padding: 0; background: transparent; color: var(--gray-700); cursor: pointer; font: 500 16px var(--font-ui); line-height: 1; display: grid; place-items: center; }
.gc-btn:hover { background: var(--gray-100); color: var(--ink); }
.gc-fit { width: auto; padding: 0 12px; border-radius: 5px; font-size: 12px; }

.run-stop { position: fixed; bottom: 30px; left: calc(var(--sidebar-w) + 232px); margin: 0; z-index: 3; }
.btn-stop { font-size: var(--text-sm); padding: var(--space-1) var(--space-3);
  border-radius: 999px; border: 1px solid var(--err); color: var(--err-ink);
  background: transparent; cursor: pointer; }
.btn-stop:hover:not(:disabled) { background: rgba(220,38,38,.10); }
.btn-stop:disabled { border-color: var(--gray-300); color: var(--gray-500); cursor: default; }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .cube { background: var(--surface-solid); }
}

.menu-btn { display: none; }
.md-body { font-size: 16px; line-height: 1.7; color: var(--gray-800); max-width: 68ch; margin-inline: auto; overflow-wrap: anywhere; }
.md-body h1 { font-size: 26px; font-weight: 550; letter-spacing: -.03em; line-height: 1.3; margin: 0 0 24px; color: var(--ink); }
.md-body h2 { font-size: 19px; font-weight: 550; line-height: 1.4; letter-spacing: -.015em; margin: 30px 0 12px; color: var(--ink); }
.md-body p, .md-body ul, .md-body ol { margin: 0 0 18px; }
.md-body li { margin: 4px 0; }
.review-actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
textarea[name="feedback"] { width: 100%; padding: var(--space-2);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--glass-bg); font: inherit; font-size: var(--text-md); resize: vertical; }

.loop { position: relative; padding: 0; border: none; background: none;
  cursor: pointer; }
.loop::before { content: ""; position: absolute; inset: -32px -12px -12px; border: 1px solid var(--gray-300); border-radius: 12px; background: var(--surface-chip); pointer-events: none; z-index: -1; }
.loop:hover::before { border-color: var(--accent); }
.loop.active::before { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.loop-done::before { border-color: var(--gray-300); }
.loop-failed::before { border-color: var(--err); border-style: solid; }
.loop-running::before { border-color: var(--accent); }

.loop-header { position: absolute; bottom: 100%; left: 0; margin: 0 0 4px 0;
  display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm);
  white-space: nowrap; line-height: 1; min-height: 24px; pointer-events: auto; }
.loop-icon { font-size: 1rem; color: var(--accent); }
.loop-id { font-weight: 700; color: var(--ink); }
.loop-condition { color: var(--gray-600); flex: 1; }
.loop-counter { color: var(--accent); font-weight: 600; white-space: nowrap; }
.chain-nested { margin-left: var(--space-3); }

.fan-out { border: 1px solid var(--gray-300); border-radius: 12px; padding: 20px; background: var(--branch); flex: 0 0 auto; }

.fan-out-header { display: flex; gap: var(--space-2); align-items: center;
  min-height: 28px; cursor: pointer; font-weight: 700; color: var(--ink);
  margin-bottom: var(--space-3); }
.fan-out-icon { color: var(--accent); }

.fan-branches { display: flex; flex-direction: column; gap: var(--space-4); }
.fan-branch { display: flex; flex-direction: row; align-items: center; gap: var(--space-3); }

.fan-branch-name { min-width: 68px; font-size: 12px; color: var(--gray-600); font-weight: 400; }
.fan-branch .chain-nested { margin-left: 0; }
.fan-out.fan-out-running { border-color: var(--accent); }

.for-each { display: flex; flex-direction: column; }

.for-each > .fan-out-header { flex-wrap: wrap; row-gap: 2px; }
.for-each-over { white-space: nowrap; }
.for-each-over { font-weight: 400; color: var(--gray-600); font-size: var(--text-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.for-each-counter { font-size: var(--text-sm); color: var(--accent-ink); font-weight: 600;
  white-space: nowrap; }
.for-each-done    { border-color: var(--ok);  border-style: solid; }
.for-each-failed  { border-color: var(--err); border-style: solid; }
.for-each-running { border-color: var(--accent); }
.for-each-waiting_manual { border-color: var(--warn); border-style: solid; }
.for-each > .chain-nested { margin-left: 0; }

.item-strip { list-style: none; margin: var(--space-3) 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px; max-width: 340px; }
.item-tile { display: grid; place-items: center; min-width: 28px; height: 28px;
  padding: 0 4px; border-radius: var(--radius-sm); border: 1px solid var(--gray-300);
  background: var(--surface-chip); color: var(--gray-700); text-decoration: none;
  font-size: 12px; font-variant-numeric: tabular-nums; }
.item-tile:hover { border-color: var(--accent); color: var(--ink); }

.item-done    { border-color: var(--ok);  color: var(--ok-ink); }
.item-failed  { border-color: var(--err); color: var(--err-ink); }
.item-running { border-color: var(--accent); color: var(--accent-ink); }
.item-waiting_manual { border-color: var(--warn); background: var(--warn-weak); color: var(--warn-ink); }
@media (prefers-reduced-motion: reduce) { .item-running { animation: none; } }

.item-rows { list-style: none; margin: var(--space-1) 0; padding: 0; }
.item-row { display: flex; align-items: center; gap: var(--space-2); min-height: 32px;
  padding: 0 var(--space-2); border-radius: var(--radius-sm); color: var(--gray-800);
  text-decoration: none; font-size: var(--text-sm); }
.item-row:hover { background: var(--gray-100); }
.item-index { min-width: 2.2em; color: var(--gray-600); font-variant-numeric: tabular-nums; }
.item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.item-state { white-space: nowrap; }
.item-state.status-done { color: var(--ok-ink); }
.item-state.status-failed { color: var(--err-ink); }
.item-state.status-waiting_manual { color: var(--warn-ink); }

.cycle-badge { display: inline-block; font-size: .72rem; font-weight: 600;
  color: var(--accent); background: var(--accent-weak);
  border-radius: 999px; padding: 0 var(--space-1); margin-left: var(--space-1);
  vertical-align: middle; }

.run-picker { position: relative; }
.run-picker-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 7px 10px; border: 1px solid var(--gray-200); border-radius: 7px; background: var(--surface-chip); font-size: 13px; font-weight: 400; color: var(--gray-700); white-space: nowrap; cursor: pointer; list-style: none; }

.run-picker-btn::-webkit-details-marker { display: none; }
.run-picker-btn::marker { content: ""; }
.run-picker-btn:hover { color: var(--ink); background: var(--surface-chip); }
.run-picker[open] > .run-picker-btn { background: var(--accent-weak);
  color: var(--accent-ink); }
.rp-caret { font-size: .7em; line-height: 1; transition: transform .15s var(--ease); }
.run-picker[open] .rp-caret { transform: rotate(180deg); }

.run-history { position: absolute; z-index: 40; top: calc(100% + var(--space-2));
  left: 0; width: max-content; min-width: 260px; max-width: min(420px, 86vw);
  max-height: min(60vh, 420px); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-1) var(--space-2); border-radius: var(--radius-md);
  background: var(--surface-solid); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg); }
.run-row-wrap { display: flex; align-items: center; gap: var(--space-1); }
.run-row { flex: 1 1 auto; min-width: 0; display: block; text-decoration: none;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  color: var(--ink); transition: background .15s var(--ease); }
.run-row:hover { background: var(--surface-chip); }

.run-row-on { box-shadow: inset 3px 0 0 var(--accent); }

:is(.sched-picker, .concurrency-panel) { position: relative; }
:is(.sched-btn, .concurrency-btn) { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 7px 10px; border: 1px solid var(--gray-200); border-radius: 7px; background: var(--surface-chip); font: 400 13px var(--font-ui); color: var(--gray-700); white-space: nowrap; cursor: pointer; list-style: none; }
:is(.sched-btn, .concurrency-btn)::-webkit-details-marker { display: none; }
:is(.sched-btn, .concurrency-btn)::marker { content: ""; }
:is(.sched-btn, .concurrency-btn):hover { color: var(--ink); background: var(--surface-chip); }
:is(.sched-picker, .concurrency-panel)[open] > :is(.sched-btn, .concurrency-btn) { background: var(--accent-weak);
  color: var(--accent-ink); }

.sched-on > :is(.sched-btn, .concurrency-btn) { color: var(--accent-ink); background: var(--accent-weak); }
.sp-days + .sp-time { margin-left: .3em; }

:is(.sched-body, .concurrency-body) { position: absolute; z-index: 40; top: calc(100% + var(--space-2));
  left: 0; width: max-content; min-width: 280px; max-width: min(420px, 86vw);
  max-height: min(64vh, 520px); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
  background: var(--surface-solid); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg); }
.sched-toggle { display: flex; align-items: center; gap: var(--space-2);
  margin: var(--space-2) 0; font-size: var(--text-sm); cursor: pointer; }
.sched-toggle input { width: 24px; height: 24px; flex: none; }
.sched-next { margin: var(--space-1) 0; font-size: var(--text-sm); color: var(--ink); }

.sched-skip { margin: var(--space-2) 0; padding: var(--space-2);
  border-radius: var(--radius-sm); background: var(--surface-chip);
  font-size: var(--text-sm); color: var(--gray-700); }

.sched-days { display: flex; flex-wrap: wrap; gap: var(--space-1);
  margin: var(--space-2) 0; }

.day-chip { position: relative; flex: 1 1 0; min-width: 0; }
.day-chip input { position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer; }
.day-chip span { display: block; padding: var(--space-2) var(--space-1);
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--gray-100); color: var(--gray-700);
  font-size: var(--text-sm); font-weight: 600; text-align: center;
  white-space: nowrap; transition: background .15s var(--ease); }
.day-chip input:checked + span { background: var(--accent-weak);
  border-color: var(--accent); color: var(--accent-ink); }
.day-chip input:focus-visible + span { outline: 2px solid var(--accent);
  outline-offset: 2px; }
.run-row-on .run-row-age { color: var(--accent-ink); }

.run-row-wrap:has(> .run-row-on) { border-radius: var(--radius-sm);
  box-shadow: inset 3px 0 0 var(--accent); }
.run-row-wrap:has(> .run-row-on) > .run-row-on { box-shadow: none; }
.run-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.run-row-title { display: flex; align-items: center; flex-wrap: wrap;
  gap: 2px var(--space-2); font-size: var(--text-sm); font-weight: 600;
  min-width: 0; overflow: hidden; }
.run-row-title > .badge { flex: 0 0 auto; }
.run-row-age { color: var(--ink); white-space: nowrap; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; }

.run-row-meta { display: flex; align-items: baseline; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--gray-700); min-width: 0; }
.run-row-dur { white-space: nowrap; font-variant-numeric: tabular-nums; }
.run-row-inputs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.run-row-def { border-bottom: 1px solid var(--gray-200);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin-bottom: var(--space-1); }
.run-row-older { text-align: center; }
.run-row-older .run-row-main { align-items: center; }
.run-row-stop { margin: 0; flex: 0 0 auto; }
.btn-stop-sm { font-size: var(--text-sm); padding: var(--space-1) var(--space-2);
  white-space: nowrap; }

@keyframes spin { to { transform: rotate(360deg); } }
.inline-spinner,
button.htmx-request::after,
form.htmx-request button[type="submit"]::after {
  content: ""; display: inline-block; width: 1em; height: 1em;
  vertical-align: -.15em; border: 2px solid currentColor;
  border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite; }
button.htmx-request::after,
form.htmx-request button[type="submit"]::after { margin-left: .5em; }
.inline-spinner { margin-right: .5em; }
button.htmx-request, form.htmx-request button[type="submit"] { cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  .inline-spinner, button.htmx-request::after,
  form.htmx-request button[type="submit"]::after { animation: none; }
}

.secret-row { margin: var(--space-2) 0 var(--space-3); padding: var(--space-3);
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--surface-chip); }
.secret-row .kv-head { margin-top: 0; display: flex; align-items: center;
  gap: var(--space-2); flex-wrap: wrap; }
.secret-row .field { margin-bottom: var(--space-2); }
.secret-row .btn-run { margin-top: var(--space-2); }

.btn-link { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 11px; margin: 4px 0; border: 1px solid var(--gray-300); border-radius: 7px; background: var(--surface-chip); font: 500 13px var(--font-ui); cursor: pointer; color: var(--ink); text-decoration: none; }
.btn-link .icon { width: 14px; height: 14px; margin-left: 6px; }
.btn-link:hover { background: var(--accent-weak); }

.drawer-note { font-size: var(--text-sm); color: var(--gray-600); margin: var(--space-2) 0; }
.step-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-1) 0; }
.step-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.step-chip .cube-icon { font-size: 1rem; }

.empty-state, .error-card { width: min(100%, 480px); margin: 0 auto; padding: 36px; border-radius: 18px; color: var(--gray-800); background: var(--panel); }
.empty-state { margin-top: 12vh; margin-left: calc(var(--sidebar-w) + var(--space-4) * 2); }
.empty-state h2, .error-card h1 { font-size: var(--text-lg); letter-spacing: -.02em;
  margin: 0 0 var(--space-3); }
.empty-state p, .error-card p { margin: var(--space-2) 0; }
.empty-state code, .error-card code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-sm); background: var(--gray-100); border-radius: var(--radius-sm);
  padding: 1px 5px; }
.empty-path code { font-size: var(--text-md); }

.empty-state a { color: var(--accent-ink); }
.empty-sample { margin: var(--space-2) 0 var(--space-3); padding: var(--space-3);
  border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  background: var(--surface-chip); overflow-x: auto; }
.empty-sample code { background: none; padding: 0; line-height: 1.45; }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); }
.error-status { font-size: var(--text-sm); font-weight: 700; color: var(--gray-600);
  letter-spacing: .04em; }
.error-detail { color: var(--gray-700); }
.error-path code { word-break: break-all; }
.error-list { list-style: none; margin: var(--space-1) 0 var(--space-3); padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--space-2); }
.error-list a { display: inline-flex; align-items: center; min-height: 28px;
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-md);
  background: var(--gray-100); color: var(--gray-800); text-decoration: none;
  font-size: var(--text-sm); }
.error-list a:hover { background: var(--accent-weak); color: var(--accent-ink); }
.error-home { margin-top: var(--space-3); }

.acct-page { padding: 44px; max-width: 900px; margin-left: calc(var(--sidebar-w) + 32px); overflow-y: auto; height: 100%; }
.acct-panel { padding: 28px 0; border: 0; border-bottom: 1px solid var(--gray-200); border-radius: 0; margin: 0; box-shadow: none; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.acct-who { font-weight: 600; margin: var(--space-2) 0; }
.acct-who .wf-ref { font-weight: 400; margin-left: var(--space-2); }
.acct-list { list-style: none; padding: 0; margin: var(--space-3) 0; }
.acct-row { display: flex; align-items: center; gap: var(--space-2);
  flex-wrap: wrap; padding: var(--space-2) 0;
  border-bottom: 1px solid var(--gray-200); }
.acct-row:last-child { border-bottom: none; }
.acct-name { font-weight: 600; margin-right: auto; }
.acct-row form { margin: 0; }
.token-value { word-break: break-all; padding: var(--space-2);
  background: var(--gray-100); border-radius: var(--radius-sm); }

.auth-msg { margin: var(--space-2) 0; font-size: var(--text-sm); }

.auth-ok { color: var(--ok-ink); }
.auth-err { color: var(--err-ink); }

.acct-flash { scroll-margin-top: 56px; }







/* Shared chrome and readable graph state. */
button, input, textarea, select { font-family: inherit; }
input, textarea { caret-color: var(--accent); }
a { text-underline-offset: 3px; }
::selection { background: var(--accent-weak); color: var(--ink); }
.icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.brand .icon { width: 25px; height: 25px; color: var(--ink); }
.sidebar-scroll { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.catalog-search { position: relative; display: flex; align-items: center; margin: 0 8px; }
.catalog-search .icon { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--gray-500); }
.catalog-search input { min-width: 0; width: 100%; border: 1px solid var(--gray-200); border-radius: 7px; background: var(--surface-chip); color: var(--ink); padding: 9px 10px 9px 32px; font-size: 13px; }
.catalog-search input::placeholder { color: var(--gray-500); }
.catalog-empty { padding: 12px; color: var(--gray-600); font-size: 13px; }
.wf-title-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.wf-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wf-toolbar .hdr-run { margin-left: auto; }
.wf-header .used-by { font-size: 12px; white-space: normal; }



.cube-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gray-500); margin-top: auto; }
.cube-done .cube-status { color: var(--ok-ink); }
.cube-failed .cube-status { color: var(--err-ink); }
.cube-waiting_manual .cube-status { color: var(--warn-ink); }
.cube-running .cube-status { color: var(--accent-ink); }
.cube-status .icon { width: 13px; height: 13px; }
.drawer-close:hover { background: var(--gray-100); color: var(--ink); }
.review-actions .btn-run + .btn-run { background: var(--surface-solid); color: var(--ink); border-color: var(--gray-300); box-shadow: none; }
.field input, .field select, .field textarea, .prompt-edit, textarea[name="feedback"] { background: var(--surface-solid); border-color: var(--gray-300); border-radius: 7px; box-shadow: inset 0 1px 2px var(--shadow-color); }
.field input::placeholder, .field textarea::placeholder { color: var(--gray-500); }
.md-body img { max-width: 100%; height: auto; border-radius: 6px; }
.md-body table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 20px 0; }
.md-body th, .md-body td { padding: 10px 12px; border-bottom: 1px solid var(--gray-200); text-align: left; vertical-align: top; }
.md-body th { background: var(--gray-100); font-weight: 600; }
.md-body blockquote { margin: 20px 0; padding: 12px 18px; background: var(--gray-100); border-radius: 7px; }
.md-body blockquote p:last-child { margin-bottom: 0; }
.md-body a { color: var(--accent-ink); }
.modal-body .md-body { max-height: none; overflow: visible; padding: 0; }
.acct-page > h1 { margin: 0 0 10px; font-size: 26px; font-weight: 550; letter-spacing: -.035em; }
.acct-panel > .kv-head { font-size: 17px; color: var(--ink); margin: 0 0 12px; }
.acct-panel .error-detail { max-width: 65ch; font-size: 14px; line-height: 1.65; }
.auth-brand { margin-bottom: 30px; font-size: 14px; color: var(--gray-600); display: flex; gap: 8px; align-items: center; }
.auth-form .error-card h1 { font-size: 28px; font-weight: 550; margin-bottom: 20px; }
.auth-form .btn-run { width: 100%; margin-top: 8px; }














@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--surface-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

.badge-action { border: 0; border-radius: 4px; color: inherit; background: transparent; width: 28px; height: 28px; display: inline-grid; place-items: center; cursor: pointer; margin: -4px -6px -4px 4px; vertical-align: middle; }
.badge-action:hover { background: var(--warn-weak); }
.sp-kind { display: inline-flex; align-items: center; gap: 6px; }
.sp-kind .icon { width: 15px; height: 15px; }

.gc-scale { min-width: 42px; text-align: center; font-size: 11px; color: var(--gray-600); font-variant-numeric: tabular-nums; }






.secret-badge .icon { width: 13px; height: 13px; }
.kv-head-icon { display: inline-flex; vertical-align: middle; }

.secret-description { font-size: 14px; line-height: 1.6; color: var(--gray-700); margin: 8px 0; }

.review-open { width: 100%; min-height: 44px; justify-content: flex-start; background: var(--accent-weak); border-color: var(--accent); color: var(--accent-ink); }
.review-tools { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--gray-200); }

.sched-inputs { border-top: 1px solid var(--gray-200); margin: 14px 0; padding-top: 8px; }
.sched-inputs > summary { cursor: pointer; min-height: 32px; padding: 4px 0; font-size: 13px; color: var(--gray-700); }
.sched-inputs > summary span { margin-left: 4px; color: var(--gray-500); }

/* Queue information stays outside the pannable graph, like run controls. */
.run-queue { position: absolute; z-index: 12; left: 18px; bottom: 88px; max-width: min(440px, calc(100% - 36px)); padding: 12px 16px; border-radius: 12px; font-size: 13px; overflow-wrap: anywhere; }
.run-queue p { margin: 0 0 6px; }
.run-queue a { display: inline-block; padding-block: 4px; }
#concurrency-panel select { width: 100%; min-height: 40px; }
