:root {
  --bg: #0c0d0f;
  --bg-deep: #08090a;
  --surface: #131416;
  --surface-2: #1b1c1f;
  --border: #25272b;
  --border-strong: #34363b;
  --text: #ecedef;
  --text-muted: #8a8f98;
  --accent: #6e7bf2;
  --accent-hover: #828df5;
  --accent-ring: rgba(110, 123, 242, 0.28);
  --wb: #a26bf0;
  --oz: #4d8df7;
  --success: #3ecf8e;
  --error: #f0616d;
  --warning: #f2b23e;
  --idle: #5c6068;
  --radius: 10px;
  --log-height: 220px;
  --sidebar-width: 248px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
  --font: 'Geist', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Geist Mono', 'Cascadia Code', Consolas, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--surface-2);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header h1 { font-size: 1.4rem; font-weight: 700; }

.header__subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.1rem;
}

.header a.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header__running {
  margin-left: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--text);
  transition: background 0.3s, color 0.3s;
}

.header__running--active {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
  animation: softPulse 2s ease-in-out infinite;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--idle);
  transition: background 0.3s;
}

.status-dot--ok { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot--err { background: var(--error); }

@keyframes softPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── App layout: sidebar + content ── */
.app-body {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 72px);
}

.sidebar {
  position: sticky;
  top: 72px;
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 1rem 0.75rem 2rem;
  border-right: 1px solid var(--surface-2);
  background: var(--surface);
}

.sidebar__section {
  margin-bottom: 1.25rem;
}

.sidebar__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.sidebar__section-head .sidebar__title {
  padding-bottom: 0;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.sidebar__title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 0.5rem 0.75rem;
}

.sidebar-fold {
  margin-bottom: 0.85rem;
}

.sidebar-fold--nested {
  margin: 0.35rem 0 0;
  padding: 0.25rem 0 0;
  border-top: 1px dashed var(--surface-2);
}

.sidebar-fold > :not(summary) {
  margin-top: 0.35rem;
}

.sidebar-fold__sum {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.2rem 0.5rem;
  user-select: none;
}

.sidebar-fold__sum::-webkit-details-marker,
.sidebar-fold__sum::marker {
  display: none;
  content: '';
}

.sidebar-fold__sum::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #6b6f76;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.sidebar-fold[open] > .sidebar-fold__sum::before {
  transform: rotate(90deg);
}

.sidebar-fold__sum:hover {
  color: var(--text);
}

.sidebar-fold__count {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  color: #8a8f98;
  background: #111214;
  border: 1px solid #222429;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}

.list-section--demo {
  display: block;
  margin-top: 0.5rem;
}

.list-section--demo[hidden] {
  display: none;
}

.list-section--demo > .list-section__hint,
.list-section--demo > .list-section__grid {
  margin-top: 0.75rem;
}

.list-section--demo > summary {
  cursor: pointer;
  list-style: none;
}

.list-section--demo > summary::-webkit-details-marker,
.list-section--demo > summary::marker {
  display: none;
  content: '';
}

.list-section--demo > summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 0.45rem;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid #6b6f76;
  transform: translateY(-1px);
}

.list-section--demo[open] > summary::before {
  transform: rotate(90deg) translateX(-1px);
}

.list-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.list-section + .list-section {
  margin-top: 0.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--surface-2);
}

.list-section__title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}

.list-section__hint {
  margin: -0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.list-section__grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.script-folder {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.script-folder__title {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.script-folder__empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.folder-row {
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.folder-row:hover,
.folder-row.folder-drop {
  background: rgba(110, 123, 242, 0.08);
  border-color: #a3abff;
}

.folder-row--active {
  background: #111214;
  border-color: #6b6f76;
}

.new-folder {
  display: flex;
  gap: 0.35rem;
  margin: 0 0.5rem 0.45rem;
}

.new-folder[hidden] {
  display: none !important;
}

.new-folder .input {
  flex: 1;
  min-width: 0;
}

.folder-error {
  margin: 0 0.5rem 0.35rem;
  color: var(--error);
  font-size: 0.75rem;
}

.folder-error:empty {
  display: none;
}

.card.is-out-of-folder,
.nav-item.is-out-of-folder,
.list-section[hidden] {
  display: none !important;
}

.card[draggable="true"] .card__title,
.nav-item[draggable="true"] {
  cursor: grab;
}

.sidebar-add {
  margin: 0 0.5rem 0.45rem;
  padding: 0.2rem 0.45rem;
  border: 1px dashed var(--border, #222429);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.sidebar-add:hover {
  color: var(--text);
  border-color: #a3abff;
}

.folder-drop {
  outline: 1px dashed #a3abff;
  background: rgba(110, 123, 242, 0.08);
}

.ctx-menu {
  position: fixed;
  z-index: 50;
  min-width: 180px;
  padding: 0.3rem;
  border: 1px solid #222429;
  border-radius: 8px;
  background: #111214;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.ctx-menu[hidden] {
  display: none;
}

.ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.5rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.ctx-menu button:hover:not(:disabled) {
  background: #16171a;
}

.ctx-menu button:disabled {
  opacity: 0.45;
  cursor: default;
}

.list-section__empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.75rem 0;
}

.list-section__empty.hidden {
  display: none;
}

.list-section--workspaces .card--workspace {
  border-left: 4px solid #6e7bf2;
}

.card a.board-btn,
.card a.download-btn,
.card a.edit-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cred-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cred-list__empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
  font-style: italic;
}

.cred-list__empty.hidden { display: none; }

.cred-item {
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  background: transparent;
}

.cred-item:hover {
  background: rgba(138, 143, 152, 0.08);
}

.cred-item__main {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-radius: 8px 0 0 8px;
}

.cred-item__name {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cred-item__meta {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.cred-item__del {
  width: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 8px 8px 0;
}

.cred-item__del:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.12);
}

.sidebar-link {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(138, 143, 152, 0.08);
}

.sidebar-link__name {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--mono);
}

.sidebar-link__meta {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.field--grow {
  flex: 1;
  min-height: 0;
}

.deps-status {
  font-size: 0.85rem;
  font-weight: 600;
}

.deps-status--running { color: var(--warning); }
.deps-status--ok { color: var(--success); }
.deps-status--err { color: var(--error); }

.deps-log {
  flex: 1;
  min-height: 160px;
  max-height: 40vh;
  overflow: auto;
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: #08090a;
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.45;
  color: #d0d3d8;
  white-space: pre-wrap;
  word-break: break-word;
}

.sidebar__nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: stretch;
  border-radius: 8px;
  transition: background 0.2s;
}

.nav-item--active {
  background: rgba(139, 92, 246, 0.12);
}

.nav-item--running {
  background: rgba(245, 158, 11, 0.1);
}

.nav-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.5rem;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
  border-radius: 8px 0 0 8px;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--wb);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--idle);
  transition: background 0.3s, box-shadow 0.3s;
}

.nav-item--running .nav-dot {
  background: var(--warning);
  animation: ringPulse 1.2s ease-in-out infinite;
}

.nav-item--success .nav-dot { background: var(--success); }
.nav-item--error .nav-dot { background: var(--error); }

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

.nav-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-file {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-run {
  flex-shrink: 0;
  width: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.nav-run:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--wb);
}

.nav-run:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.nav-run--spinning .nav-run__icon {
  display: inline-block;
  animation: spin 1s linear infinite;
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 3px;
}

.sidebar__nav::-webkit-scrollbar { height: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 2px;
}

/* ── List layout: 1 script = 1 row ── */
.list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem 3rem;
}

.card {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.4s, box-shadow 0.4s;
  animation: cardIn 0.35s ease-out both;
  scroll-margin-top: 88px;
}

.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.11s; }
.card:nth-child(5) { animation-delay: 0.14s; }
.card:nth-child(6) { animation-delay: 0.17s; }
.card:nth-child(7) { animation-delay: 0.20s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card--wb { border-left: 4px solid var(--wb); }
.card--oz { border-left: 4px solid var(--oz); }
.card--neutral { border-left: 4px solid var(--border); }

.card--running {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2), var(--shadow);
}

.card--flash-success {
  animation: flashSuccess 1.2s ease-out;
}

.card--flash-error {
  animation: flashError 0.6s ease-out;
}

@keyframes flashSuccess {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); border-color: var(--success); }
  70% { box-shadow: 0 0 20px 4px rgba(34, 197, 94, 0.15); }
  100% { box-shadow: var(--shadow); }
}

@keyframes flashError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.card__left {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-right: 1px solid var(--surface-2);
}

.card__right {
  padding: 1rem 1.25rem;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card__right--ws {
  padding: 12px;
  background: var(--bg);
  border-left: 1px solid var(--border);
}

.ws-log-split {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.logs--ws-chain,
.logs--ws-script {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-deep);
}

.logs--ws-chain .logs__toolbar,
.logs--ws-script .logs__toolbar {
  margin: 0;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.logs--ws-chain .logs__output,
.logs--ws-script .logs__output {
  flex: 1 1 auto;
  height: auto;
  max-height: none;
  min-height: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.ws-script-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  max-width: none;
  margin: 0;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ws-script-tabs:empty { display: none; }

.ws-script-tab {
  border: 1px solid var(--surface-2);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
}

.ws-script-tab:hover {
  color: var(--text);
  border-color: var(--border);
}

.ws-script-tab--active {
  color: var(--text);
  border-color: #6e7bf2;
  background: rgba(110, 123, 242, 0.12);
}

@media (max-width: 1100px) {
  .ws-log-split {
    grid-template-columns: 1fr;
  }
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.card__title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.status-ring {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex-shrink: 0;
  background: var(--idle);
  transition: background 0.3s, box-shadow 0.3s;
}

.card--running .status-ring {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
  animation: ringPulse 1.2s ease-in-out infinite;
}

.card--success-state .status-ring {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.card--error-state .status-ring {
  background: var(--error);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

.card__title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.card__title-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card__rename {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
}

.card__rename:hover,
.card__rename:focus-visible {
  color: var(--text);
  border-color: var(--surface-2);
}

.card__file {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

.card__desc {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.3s;
}

.badge--idle { background: rgba(107, 111, 118, 0.2); color: var(--idle); }
.badge--running {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
  animation: badgePulse 1.5s infinite;
}
.badge--success { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.badge--error { background: rgba(239, 68, 68, 0.2); color: var(--error); }
.badge--cancelled { background: rgba(138, 143, 152, 0.2); color: #8a8f98; }

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.65rem;
  background: var(--bg);
  border-radius: 8px;
}

.meta-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-value {
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.2s;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: linear-gradient(135deg, var(--wb), #7c3aed);
  color: white;
  width: 100%;
}

.btn--inline {
  width: auto;
}

.btn--ghost {
  background: var(--surface-2);
  color: var(--text);
}

.btn--ghost:hover:not(:disabled) {
  background: #3f5169;
}

.btn--danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--surface-2);
  width: auto;
  padding: 0.6rem 0.75rem;
}

.btn--danger-ghost:hover:not(:disabled) {
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: stretch;
}

.card__actions .run-btn {
  flex: 1 1 6rem;
}

.card__actions .board-btn,
.card__actions .edit-btn,
.card__actions .download-btn,
.card__actions .webhook-btn {
  width: auto;
  padding: 0.6rem 0.75rem;
}

.webhook-status {
  font-size: 0.72rem;
  min-height: 1em;
  color: var(--text-muted);
}

.webhook-status--ok { color: var(--success); }
.webhook-status--err { color: var(--error); }

.card--oz .btn--primary {
  background: linear-gradient(135deg, var(--oz), #5e6ad2);
}

.btn--running .btn__icon {
  display: inline-block;
  animation: spin 1s linear infinite;
}

/* ── Full-page editor ── */
body.modal-open {
  overflow: hidden;
}

.editor-page.hidden {
  display: none;
}

.editor-page {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
}

.editor-page__layout {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 320px);
  height: 100%;
  min-height: 0;
}

.editor-page__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--surface-2);
}

.editor-page__topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-2);
  flex-shrink: 0;
}

.editor-page__topbar h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.editor-page__error {
  font-size: 0.8rem;
  color: var(--error);
  text-align: right;
}

.monaco-host {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.monaco-host--page {
  height: auto;
  border: none;
  border-radius: 0;
}

.editor-page__side {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  min-height: 0;
}

.editor-page__side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--surface-2);
  flex-shrink: 0;
}

.editor-page__side-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.modal__close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

.modal__close:hover {
  color: var(--text);
}

.editor-page__fields {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.editor-page__side-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--surface-2);
  flex-shrink: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field--upload input[type="file"] {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.field-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.field-label--with-help {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.input--area {
  resize: vertical;
  min-height: 4.5rem;
  font-family: inherit;
}

.secret-value {
  flex: 1;
  min-height: 0;
  resize: none;
  border: none;
  outline: none;
  padding: 1rem 1.25rem;
  background: var(--bg);
  color: var(--text);
  font: 0.875rem/1.5 'Cascadia Code', Consolas, monospace;
}

.readonly-value--pre {
  white-space: pre-wrap;
}

.readonly-value {
  display: block;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--mono);
  word-break: break-all;
}

.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: help;
  user-select: none;
}

.help-tip__bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: 220px;
  padding: 0.55rem 0.65rem;
  background: #08090a;
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 5;
}

.help-tip:hover .help-tip__bubble,
.help-tip:focus .help-tip__bubble,
.help-tip:focus-within .help-tip__bubble {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 800px) {
  .editor-page__layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .editor-page__main {
    border-right: none;
    border-bottom: 1px solid var(--surface-2);
    min-height: 50vh;
  }

  .editor-page__side {
    max-height: 45vh;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Schedule ── */
.schedule {
  border-top: 1px solid var(--surface-2);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.schedule__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.select, .input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.select:focus, .input:focus {
  outline: none;
  border-color: var(--wb);
}

.card--oz .select:focus, .card--oz .input:focus {
  border-color: var(--oz);
}

.schedule-fields {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.schedule-fields.hidden { display: none; }

.field-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.schedule-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.schedule-save-status {
  font-size: 0.72rem;
  min-height: 1em;
  transition: opacity 0.3s;
}

.schedule-save-status--ok { color: var(--success); }
.schedule-save-status--err { color: var(--error); }

/* ── Logs: fill the card column, scroll inside ── */
.logs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  height: 100%;
}

.logs__output {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  background: #08090a;
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: #d0d3d8;
  scroll-behavior: smooth;
  user-select: text;
  cursor: text;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.logs__empty {
  position: absolute;
  inset: 1.6rem 0 0 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
  padding: 1rem;
  pointer-events: none;
}

.logs:not(.logs--has-content) .logs__empty {
  display: flex;
}

.logs__toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-shrink: 0;
}

.logs__title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logs__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.logs__live {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--warning);
  text-transform: uppercase;
}

.logs__live.hidden { display: none; }

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  animation: liveBlink 1s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.85); }
}

.logs__count {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

#mainList,
#mainList * {
  -webkit-user-drag: none;
}

#mainList .logs__output,
#mainList .logs__output * {
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}

.logs__copy {
  flex-shrink: 0;
  margin-left: auto;
  border: 1px solid #a3abff;
  background: #111214;
  color: #d0d3d8;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-user-drag: none;
}

.logs__copy:hover {
  color: var(--text);
  border-color: #a3abff;
}

.log-line {
  display: block;
  animation: logIn 0.15s ease-out;
}

@keyframes logIn {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

.log-line--stderr { color: #fca5a5; }
.log-line--system { color: var(--warning); font-style: italic; }

.logs__output::-webkit-scrollbar { width: 6px; }
.logs__output::-webkit-scrollbar-track { background: transparent; }
.logs__output::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 3px;
}

@media (max-width: 900px) {
  .app-body {
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--surface-2);
    padding: 0.75rem;
    z-index: 9;
  }

  .sidebar__nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.35rem;
    padding-bottom: 0.25rem;
  }

  .nav-item {
    flex-shrink: 0;
    min-width: 180px;
  }

  .card {
    grid-template-columns: 1fr;
  }
  .card__left {
    border-right: none;
    border-bottom: 1px solid var(--surface-2);
  }
  .list { padding: 1rem; }
  .header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

/* ── Дизайн-слой: нейтральная тёмная тема, один акцент, моно для машинных значений ── */
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { font-size: 14px; letter-spacing: -0.006em; }
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 600; }
::selection { background: var(--accent-ring); }

.header {
  position: sticky; top: 0; z-index: 30;
  padding: 0.75rem 1.5rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header h1 { font-size: 15px; font-weight: 600; }
.header__subtitle { font-size: 12px; margin-top: 0; }
.header__running { font-family: var(--mono); font-size: 12px; border: 1px solid var(--border); background: transparent; }

.btn {
  border-radius: 7px; font-size: 13px; font-weight: 500; line-height: 1.2;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.btn--primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: none; transition: border-color 0.12s, background-color 0.12s;
}
.card:hover { border-color: var(--border-strong); }
.card--wb, .card--oz, .card--neutral { border-left-width: 1px; border-left-color: var(--border); }
.card--wb { box-shadow: inset 2px 0 0 var(--wb); }
.card--oz { box-shadow: inset 2px 0 0 var(--oz); }
.card--running { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.card__title { font-weight: 600; letter-spacing: -0.01em; }
.card__file, .card__meta, code, kbd, pre, .logs__output, .log-line { font-family: var(--mono); }
.card__file, .card__meta { font-size: 12px; color: var(--text-muted); }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea {
  background: var(--bg-deep); border: 1px solid var(--border); border-radius: 7px; color: var(--text); font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--idle); }

.sidebar { background: var(--bg); border-right: 1px solid var(--border); }
.sidebar__title { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--idle); }
.sidebar-link { border-radius: 6px; }
.sidebar-link:hover { background: var(--surface-2); }
a.sidebar-link { text-decoration: none; color: inherit; }

.sidebar-group__title {
  margin: 1.1rem 0.6rem 0.4rem; padding-top: 0.9rem; border-top: 1px solid var(--border);
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--idle);
}
.version-list { list-style: none; max-height: 180px; overflow: auto; display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; }
.version-list__btn {
  width: 100%; text-align: left; padding: 0.3rem 0.55rem; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--text); font-family: var(--mono); font-size: 12px; cursor: pointer;
}
.version-list__btn:hover { background: var(--surface-2); border-color: var(--border); }

.header-menu { position: relative; }
.header-menu > summary { list-style: none; cursor: pointer; }
.header-menu > summary::-webkit-details-marker { display: none; }
.header-menu[open] > summary { border-color: var(--border-strong); background: var(--surface-2); }
.header-menu__list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 210px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.header-menu__list .btn { width: 100%; justify-content: flex-start; }
.ws-page .header { justify-content: flex-start; }
.ws-page .header__nav { margin-right: auto; }
.ws-page .ws-title { margin-top: 0; height: 32px; }
.ws-page .ws-title { margin-top: 0; flex: 0 1 320px; min-width: 0; }
.ws-page .ws-title__input { max-width: 100%; }
.ws-page .ws-title__input:focus { border-color: var(--accent); }

.status-dot--ok { box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.status-dot--err { box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 18%, transparent); }

.logs { background: var(--bg-deep); border-top: 1px solid var(--border); }
.log-line { font-size: 12px; line-height: 1.55; }
.log-line--stderr { color: var(--error); }

table { font-variant-numeric: tabular-nums; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* ── Вёрстка: шапка с вкладками, компактная сетка карточек, лог появляется по делу ── */
:root { --header-h: 57px; }
.header {
  height: var(--header-h);
  min-height: var(--header-h);
  padding: 0 1.25rem;
  gap: 1.25rem;
  align-items: center;
}
.header h1 { font-size: 15px; font-weight: 600; line-height: 1; }
.header__brand { flex: 0 0 auto; }
.header__nav { display: flex; align-items: center; gap: 2px; margin-right: auto; flex: 0 0 auto; }
.header__actions { margin-left: 0; flex: 0 1 auto; min-width: 0; }
.header__link {
  padding: 0.4rem 0.7rem; border-radius: 6px; color: var(--text-muted);
  font-size: 13px; font-weight: 500; text-decoration: none; transition: color 0.12s, background-color 0.12s;
}
.header__link:hover { color: var(--text); background: var(--surface-2); }
.header__link[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.header__status { margin-right: 0.25rem; white-space: nowrap; }
.header__actions { flex-wrap: nowrap; }
.header__actions .btn { width: auto; flex: none; white-space: nowrap; }

.sidebar { top: var(--header-h); height: calc(100vh - var(--header-h)); }
.app-body { min-height: calc(100vh - var(--header-h)); }

.list { padding: 1.25rem; gap: 1.5rem; max-width: none; }
.folder-view-head h2 { font-size: 20px; }
.list-section__title { font-size: 13px; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.list-section__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; align-items: stretch; }
.list-section__grid > .card { height: 100%; }
.card__left { height: 100%; }
.card__desc {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  overflow: hidden; min-height: calc(2 * 1.45em);
}
.card__left .schedule { margin-top: auto; }

.card { grid-template-columns: minmax(300px, 360px) 1fr; }
.card__left { border-right-color: var(--border); padding: 1rem 1.1rem; gap: 0.75rem; }
.card__meta { background: var(--bg-deep); border: 1px solid var(--border); padding: 0.5rem 0.65rem; }
.card__desc { color: var(--text-muted); font-size: 13px; line-height: 1.45; }

/* Пока лога нет и ничего не запущено, карточка — компактная плитка без пустой панели */
.card:not(.card--open):not(.card--running):not([data-status="running"]):not(:has(.logs__output:not(:empty))) { grid-template-columns: 1fr; }
.card:not(.card--open):not(.card--running):not([data-status="running"]):not(:has(.logs__output:not(:empty))) .card__right { display: none; }
.card:not(.card--open):not(.card--running):not([data-status="running"]):not(:has(.logs__output:not(:empty))) .card__left { border-right: none; }
/* С логом карточка занимает всю строку сетки */
.list-section__grid > .card:is(.card--open, .card--running, [data-status="running"], :has(.logs__output:not(:empty))) { grid-column: 1 / -1; }
.card__right { padding: 0.75rem 1rem; }
.card .logs { border-top: none; background: transparent; min-height: 260px; max-height: 420px; }
.card .logs--ws-chain,
.card .logs--ws-script {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  max-height: none;
  min-height: 280px;
}
.logs__output { background: var(--bg-deep); border-color: var(--border); }
.logs__copy { border: 1px solid var(--border); background: transparent; color: var(--text-muted); border-radius: 6px; font-size: 12px; padding: 0.2rem 0.55rem; cursor: pointer; }
.logs__copy:hover { color: var(--text); border-color: var(--border-strong); }
.card__actions {
  display: flex;
  width: 100%;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-deep);
}
.card__actions > .btn,
.card__actions > a.btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.card__actions > :last-child { border-right: 0; }
.card__actions > .btn:hover,
.card__actions > a.btn:hover { background: var(--surface-2); color: var(--text); }
.card__actions > .run-btn { background: var(--accent); color: #fff; }
.card__actions > .run-btn:hover { background: var(--accent-hover); color: #fff; }
.card__actions > .delete-btn:hover { background: color-mix(in srgb, var(--error) 16%, transparent); color: var(--error); }
.card__actions .logs-btn[aria-expanded="true"] { color: var(--accent-hover); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.card__actions svg { width: 16px; height: 16px; display: block; }
.card__actions .btn__icon--stop { display: none; }
.card__actions .run-btn.btn--running .btn__icon--play { display: none; }
.card__actions .run-btn.btn--running .btn__icon--stop { display: block; }
.card__actions .btn--running .btn__icon { animation: none; }
.card__rename { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; }
.card__rename svg { width: 14px; height: 14px; display: block; }

.list-section__empty, .cred-list__empty {
  color: var(--text-muted); font-size: 13px; padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center;
}
.cred-list__empty { padding: 0.5rem; font-size: 12px; }

@media (max-width: 1100px) {
  .header__brand .header__subtitle { display: none; }
}
@media (max-width: 900px) {
  .header { flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.6rem 1rem; position: static; }
  .header__nav { order: 3; width: 100%; overflow-x: auto; margin-right: 0; }
  .header__actions { margin-left: auto; }
  .sidebar { top: 0; height: auto; order: 2; border-right: none; border-top: 1px solid var(--border); }
  .list { padding: 1rem; }
  .card, .card:is(.card--running, [data-status="running"], :has(.logs__output:not(:empty))) { grid-template-columns: 1fr; }
  .card__left { border-right: none; border-bottom: 1px solid var(--border); }
}
@media (max-width: 560px) {
  .header__status #serverStatus, .header__running { display: none; }
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --bg-deep: #e8eaee;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --border: #e2e4e8;
  --border-strong: #cfd2d8;
  --text: #16181d;
  --text-muted: #5c6370;
  --idle: #6b7280;
  --shadow: 0 8px 28px rgba(16, 18, 22, 0.08), 0 0 0 1px var(--border);
  color-scheme: light;
}
.brand__mark { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.page { max-width: 880px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page--wide { max-width: 1100px; }
.page h2 { font-size: 22px; margin-bottom: 0.35rem; }
.page h3 { font-size: 15px; margin-bottom: 0.4rem; }
.page__hint { color: var(--text-muted); font-size: 13px; margin-bottom: 1rem; }
.page-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 12px 0; }
.page-tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.page-tabs button[aria-selected="true"] { background: var(--surface-2); }
.stack { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.copy-row { display: flex; gap: 8px; margin-bottom: 8px; }
.copy-row .input { flex: 1; }
.secret-page, .audit, #userList, #projectList, #versions, #runList { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.secret-page li, #versions li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toast-host { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 80; }
.toast { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; max-width: 420px; }
.ask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; z-index: 90; }
.ask__card { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; width: min(440px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 12px; }
.ask__row { display: flex; justify-content: flex-end; gap: 8px; }
.btn--danger { background: var(--error); color: #fff; border: 0; }
.monaco-page { height: 62vh; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.diff { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--bg-deep); border-radius: var(--radius); padding: 10px; max-height: 280px; overflow: auto; }
.diff .add { color: var(--success); }
.diff .del { color: var(--error); }
.ws-main { position: relative; }
.ws-zoom { position: absolute; right: 12px; top: 12px; display: flex; gap: 4px; z-index: 6; }
.minimap { position: absolute; left: 12px; bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; z-index: 6; }
.wizard { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: grid; place-items: center; z-index: 70; }
.wizard[hidden] { display: none; }
.wizard__card { background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 20px; width: min(480px, calc(100% - 32px)); }
.wizard__card ol { margin: 12px 0 16px 1.1rem; color: var(--text-muted); }

.set-kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 4px 0 14px; font-size: 13px; }
.set-kv dt { color: var(--text-muted); }
.set-kv dd { margin: 0; }
.set-pill { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 12px; }
.set-secret { margin-top: 4px; }
.set-secret[hidden] { display: none; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.set-row:first-child { border-top: 0; }
.set-role, .set-meta { color: var(--text-muted); font-size: 12px; }
.set-role { margin-left: 8px; }
.set-empty { color: var(--text-muted); font-size: 13px; margin: 4px 0; }
.set-form { display: grid; grid-template-columns: 1fr 1fr 160px auto; gap: 8px; margin-top: 12px; align-items: end; }
.set-form--create { grid-template-columns: 1fr auto; }
.set-form--trigger { grid-template-columns: 1fr 160px; }
.set-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.set-form [hidden] { display: none; }
.set-span { grid-column: 1 / -1; }
.set-project { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 12px; margin-top: 8px; }
.set-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.set-checks__title { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.set-checks ul { list-style: none; max-height: 200px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--bg); }
.set-checks label { display: flex; gap: 8px; align-items: center; font-size: 13px; padding: 4px 6px; cursor: pointer; }
.set-project .btn { margin-top: 10px; }
.set-audit { font-family: var(--mono); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#auditList .set-row { justify-content: flex-start; }
@media (max-width: 720px) {
  .set-kv, .set-form, .set-form--trigger, .set-checks { grid-template-columns: 1fr; }
}

.cfg {
  display: grid;
  grid-template-columns: 220px minmax(0, 720px);
  justify-content: center;
  gap: 8px 32px;
  min-height: calc(100vh - var(--header-h));
  padding: 1.25rem 1.5rem 3rem;
}
.cfg-nav, .cfg-side {
  position: sticky;
  top: calc(var(--header-h) + 12px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cfg-nav a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}
.cfg-nav a:hover { background: var(--surface); color: var(--text); }
.cfg-nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--accent);
}
.cfg-kicker {
  margin: 0 0.7rem 0.35rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cfg-side__label { margin: 12px 0.7rem 4px; font-size: 12px; color: var(--text-muted); }
.cfg-side > code {
  display: block;
  margin: 0 0.35rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
}
.cfg-side__note { margin: 14px 0.7rem 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.cfg-main { min-width: 0; }
.cfg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 1rem; }
.cfg-head h2 { font-size: 20px; margin: 0 0 4px; }
.cfg-head p, .cfg-pane > .page__hint { margin: 0; }
.cfg .btn--primary { width: auto; justify-self: start; }
.cfg-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cfg-table th { text-align: left; font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border); }
.cfg-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.cfg-table tr:last-child td { border-bottom: 0; }
.cfg-table tbody tr:hover { background: var(--surface-2); }
.cfg-name { font-family: var(--mono); font-weight: 500; }
.cfg-meta { color: var(--text-muted); font-size: 12px; }
.cfg-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.cfg-empty { border: 1px dashed var(--border); border-radius: 10px; padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); font-size: 13px; }
.cfg-dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); padding: 0; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); margin: auto; box-shadow: var(--shadow); overflow: auto; }
.cfg-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.cfg-dialog form { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.cfg-dialog h3 { margin: 0; font-size: 16px; }
.cfg-dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.cfg-value { display: flex; gap: 8px; }
.cfg-value .input { flex: 1; }
.cfg-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }
.cfg-checks { list-style: none; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--bg); }
.cfg-checks label { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); padding: 5px 6px; cursor: pointer; }
.cfg-pane[hidden] { display: none; }
.cfg #userList, .cfg #triggerList, .cfg #auditList, .cfg .set-project {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.cfg #userList, .cfg #triggerList, .cfg #auditList { padding: 0 12px; }
.cfg #userList:empty, .cfg #triggerList:empty, .cfg #auditList:empty { display: none; }
.cfg .set-form { margin-top: 14px; }
.cfg .set-empty { padding: 14px 0; }
.cfg .page-card { margin: 0; background: transparent; border: 0; padding: 0; }
@media (max-width: 800px) {
  .cfg { grid-template-columns: 1fr; padding: 0.75rem 1rem 2rem; }
  .cfg-nav, .cfg-side { position: static; }
  .cfg-nav { flex-direction: row; flex-wrap: wrap; }
}