:root {
  --bg-page: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #e4e4e7;
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #9a9aa2;
  --bg-accent-muted: #f2f5ff;
  --accent: #3b5bfd;
  --bg-warning: #fef3c7;
  --text-warning: #92620a;
  --bg-success: #dcfce7;
  --text-success: #15803d;
  --bg-danger: #fee2e2;
  --text-danger: #b91c1c;
  --bg-info: #e0f2fe;
  --text-info: #075985;
  --bg-neutral: #f1f1f3;
  --text-neutral: #52525b;
  --radius: 6px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  margin: 0;
  padding: 0 2rem 3rem;
  color: var(--text-primary);
  background: var(--bg-page);
}

header.top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 0;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 1.5rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-link:hover {
  opacity: 0.75;
}

header.top img.brand-logo {
  height: 24px;
  width: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

header.top h1 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.brand-tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
}

header.top nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

header.top a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}

header.top a:hover {
  color: var(--text-primary);
}

/* Shows the language you'd switch TO, not the current one — a single
   link/toggle instead of two side-by-side DE/EN links. */
header.top a.lang-switch {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

header.top a.lang-switch:hover {
  color: var(--text-primary);
  background: var(--bg-neutral);
}

.card {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 1.25rem;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-head .title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.card h3 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-primary);
}

.card h3:first-child {
  margin-top: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.btn:hover {
  filter: brightness(0.92);
}

/* Mirrors K-IT Formbridge's app.css — same two button variants, kept
   consistent between both projects' settings pages (and anywhere else a
   primary/secondary action pair is needed). */
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
button.ghost { background: transparent; border: 1px dashed var(--border); color: var(--accent); }
button.ghost:hover:not(:disabled) { background: var(--bg-accent-muted); border-color: var(--accent); }

.card-head .count {
  font-size: 12px;
  color: var(--text-muted);
}

.tc-list-head, .tc-row {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr 0.7fr 0.9fr 1.1fr 1.4fr;
  gap: 8px;
  align-items: center;
}

/* Our own `display: grid` above otherwise beats the browser's default
   [hidden] { display: none } rule (same specificity, author stylesheet
   wins) — this is what makes toggling `.hidden` from JS actually work. */
.tc-row[hidden] {
  display: none;
}

.tc-list-head {
  padding: 0 8px 8px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 0.5px solid var(--border);
}

.tc-row {
  padding: 10px 8px;
  border-bottom: 0.5px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
}

.tc-row:last-child {
  border-bottom: none;
}

.tc-row:hover {
  background: var(--bg-accent-muted);
}

.tc-title {
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
}

.tc-title:hover {
  text-decoration: underline;
}

.tc-cell {
  font-size: 13px;
  color: var(--text-secondary);
}

.tc-action {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.tc-action svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.tc-action-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
}

.tc-action-link:hover {
  color: var(--text-primary);
}

.inline-assign-form {
  display: flex;
  align-items: center;
  gap: 4px;
}

.inline-assign-form input[type="text"] {
  width: 4.5rem;
  padding: 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.inline-assign-form button,
.inline-release-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 3px 8px;
  color: var(--accent);
  border-color: var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th, td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 0.5px solid var(--border);
  font-size: 0.9rem;
}

/* Deployment-ID/Job-ID are for debugging, not routine reading — hidden by
   default so the message column gets the room, one click away via the
   "show IDs" toggle. */
.tech-col {
  display: none;
}

table.show-tech-cols .tech-col {
  display: table-cell;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

tr:hover td {
  background: var(--bg-accent-muted);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
}

.badge.draft { background: var(--bg-warning); color: var(--text-warning); }
.badge.ready { background: var(--bg-success); color: var(--text-success); }
.badge.successful { background: var(--bg-success); color: var(--text-success); }
.badge.failed { background: var(--bg-danger); color: var(--text-danger); }
.badge.starting, .badge.running { background: var(--bg-info); color: var(--text-info); }
.badge.unknown { background: var(--bg-neutral); color: var(--text-neutral); }

.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

.field-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.5rem;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.field-grid dt { color: var(--text-muted); }
.field-grid dd { margin: 0; }

/* Two genuinely independent .field-grid blocks side by side, each with its
   own themed set of fields (see testcase-detail.ejs) — CHANGED 2026-09-14:
   a single 4-column grid can only alternate every other field between
   "left"/"right", it can't group fields by theme regardless of how many
   there are on each side. Wraps to a single stacked column on narrow
   screens. */
.field-grid-columns {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.field-grid-columns .field-grid {
  flex: 1;
  margin-bottom: 0;
  align-self: stretch;
}

@media (max-width: 700px) {
  .field-grid-columns {
    flex-direction: column;
  }
}

code {
  background: var(--bg-neutral);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
}

section h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.filters {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.filters input {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-right: 0.5rem;
}

.empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius-lg);
}

section {
  margin-bottom: 1.5rem;
}

.action-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.action-form label {
  color: var(--text-muted);
}

.action-form input[type="text"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 12rem;
}

button {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

button svg {
  width: 14px;
  height: 14px;
  flex: none;
}

button:hover:not(:disabled) {
  background: var(--bg-accent-muted);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#variants-table .variant-row input[type="text"] {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}

#variants-table .variant-row button {
  font-size: 14px;
  padding: 2px 8px;
  line-height: 1;
}

.error-msg {
  color: var(--text-danger);
  background: var(--bg-danger);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.hint {
  color: var(--text-info);
  background: var(--bg-info);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Control Room settings page's "Verbindung testen" result — one line per
   checked item (auth, Run-As user, each pool), icon + text instead of a
   plain string so a failure among several successes still stands out. */
.test-result {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.test-result-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
}
.test-result-line svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.test-result-line.ok svg { color: var(--text-success); }
.test-result-line.fail svg { color: var(--text-danger); }
