:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-elevated: #12151c;
  --panel: #161a22;
  --panel-hover: #1b202a;
  --border: #2a3140;
  --border-soft: #222833;
  --text: #eef2f8;
  --muted: #8b97ab;
  --accent: #5b9dff;
  --accent-soft: rgba(91, 157, 255, 0.12);
  --ok: #3dd68c;
  --ok-soft: rgba(61, 214, 140, 0.14);
  --bad: #ff6b7a;
  --bad-soft: rgba(255, 107, 122, 0.14);
  --warn: #f5c451;
  --warn-soft: rgba(245, 196, 81, 0.14);
  --draft-soft: rgba(139, 151, 171, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  --radius: 14px;
  --scroll: #3a4558;
  --scroll-hover: #526075;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scroll) transparent;
}

*::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-hover);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 157, 255, 0.08), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(61, 214, 140, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.topbar {
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  height: 30px;
  padding: 0 0.85rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-link:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--panel);
  text-decoration: none;
}

.topbar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-icon-btn svg {
  width: 0.95rem;
  height: 0.95rem;
}

.topbar-icon-btn:hover {
  color: var(--text);
  border-color: var(--border);
  text-decoration: none;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  border-radius: 999px;
  padding: 0 0.65rem;
  height: 30px;
  color: var(--muted);
  font-size: 0.82rem;
  box-sizing: border-box;
}

.live-pill #status,
.live-pill #updated {
  line-height: 1;
}

.live-pill #updated {
  font-variant-numeric: tabular-nums;
}

.live-pill .clock {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.65;
}

.dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.dot.on { background: var(--ok); }
.dot.off { background: var(--bad); }

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

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand small {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

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

.page-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.page-head h1 {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.stat-value {
  margin-top: 0.2rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }
.stat-value.bad { color: var(--bad); }

.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.panel-head .count {
  color: var(--muted);
  font-size: 0.88rem;
}

.panel-compact {
  padding: 0.75rem 1rem 0.85rem;
}

.panel-compact .panel-head {
  margin-bottom: 0.5rem;
}

h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.muted { color: var(--muted); }

table.compact th,
table.compact td {
  padding: 0.45rem 0.55rem;
  font-size: 0.84rem;
}

.empty.compact {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  text-align: left;
}

.empty.compact strong {
  display: inline;
  margin: 0;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-elevated);
}

table.grid-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table.grid-table th,
table.grid-table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

table.grid-table th {
  padding: 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: #10141b;
  position: sticky;
  top: 0;
  z-index: 2;
}

.th-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem;
  min-width: 88px;
}

.th-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.th-actions {
  display: flex;
  gap: 0.1rem;
  flex-shrink: 0;
  align-items: center;
}

.th-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  filter: none;
}

.th-btn .ico {
  display: block;
  width: 14px;
  height: 14px;
}

.th-btn .ico-sort {
  width: 15px;
  height: 15px;
}

.th-btn:hover {
  color: var(--text);
  filter: none;
}

.th-btn.on {
  color: var(--accent);
}

.filter-menu {
  position: fixed;
  z-index: 40;
  display: none;
  background: #10141b;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 180px;
  max-width: 300px;
  max-height: 280px;
  overflow: auto;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  padding: 0.35rem;
}

.filter-menu.open {
  display: block;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  font-size: 0.84rem;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.filter-item.all {
  font-weight: 700;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 0.25rem;
  padding-bottom: 0.5rem;
}

.filter-item input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem !important;
}

table.grid-table th:last-child,
table.grid-table td:last-child {
  border-right: none;
}

table.grid-table tbody tr:last-child td {
  border-bottom: none;
}

table.grid-table tbody tr:hover {
  background: var(--panel-hover);
}

table.grid-table.compact th .th-inner,
table.grid-table.compact td {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

table.grid-table.compact .th-inner {
  padding: 0.45rem 0.55rem;
  min-width: 72px;
}

table.grid-table.compact th,
table.grid-table.compact td {
  font-size: 0.84rem;
}

tr.clickable-row {
  cursor: pointer;
}

.col-actions {
  width: 7.5rem;
  min-width: 7.5rem;
  white-space: nowrap;
}

#workers-table th.col-actions,
#workers-table td.col-actions {
  text-align: center;
}

#workers-table th.col-actions .th-inner {
  min-width: 7.5rem;
  justify-content: center;
}

#workers-table td.col-actions {
  vertical-align: middle;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.75rem 0.65rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

tbody tr:hover {
  background: var(--panel-hover);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.json-view {
  margin: 0;
  padding: 0.85rem;
  background: #0b0d11;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font: 0.88rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 70vh;
}

.workflow-bar .inline-form {
  display: inline-flex;
}

.job-title {
  font-weight: 600;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
}

textarea {
  width: 100%;
  font: 0.92rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #0b0d11;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
}

form label {
  margin: 0.75rem 0 0.35rem;
}

.field-hint {
  margin: -0.15rem 0 0.55rem;
  font-size: 0.84rem;
}

.mode-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  margin: 0.25rem 0 0.65rem;
  width: fit-content;
  background: #0b0d11;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.mode-tab {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.mode-tab:hover {
  color: var(--text);
  filter: none;
  background: var(--panel-hover);
}

.mode-tab.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.mode-pane.is-hidden {
  display: none;
}

.dropzone {
  position: relative;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: #0b0d11;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.dropzone-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--muted);
  pointer-events: none;
}

.dropzone-copy strong {
  color: var(--text);
  font-size: 0.95rem;
}

.file-list {
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #0b0d11;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}

.file-remove {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
}

.file-remove:hover {
  color: var(--bad);
  border-color: rgba(255, 107, 122, 0.4);
  filter: none;
}

.or-divider {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0.58rem 0.95rem;
  background: var(--accent);
  color: #08111f;
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}

a.button,
a.button:hover {
  text-decoration: none;
}

button:hover, .button:hover {
  filter: brightness(1.05);
  text-decoration: none;
}

.button.secondary, button.secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  filter: none;
}

.button.secondary:hover, button.secondary:hover {
  background: var(--panel-hover);
  border-color: var(--border);
  filter: none;
}

.button.danger, button.danger {
  background: rgba(163, 59, 74, 0.16);
  border: 1px solid rgba(255, 107, 122, 0.32);
  color: var(--bad);
  filter: none;
}

.button.danger:hover, button.danger:hover {
  background: rgba(163, 59, 74, 0.26);
  filter: none;
}

.button.btn-sm, button.btn-sm {
  padding: 0.42rem 0.78rem;
  font-size: 0.875rem;
  border-radius: 8px;
  min-height: 32px;
}

button.refresh-btn {
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  font-weight: 400;
  filter: none;
}

button.refresh-btn .ico {
  display: block;
  width: 15px;
  height: 15px;
}

button.refresh-btn:hover {
  color: var(--text);
  border-color: var(--border);
  filter: none;
}

button.refresh-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

button.refresh-btn.spinning .ico {
  animation: refresh-spin 0.7s linear infinite;
}

button.th-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  filter: none;
}

button.th-btn:hover {
  color: var(--text);
  filter: none;
}

button.th-btn.on {
  color: var(--accent);
}

button.th-btn .ico {
  display: block;
  width: 14px;
  height: 14px;
}

button.th-btn .ico-sort {
  width: 15px;
  height: 15px;
}

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

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

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--draft-soft);
  color: var(--muted);
  white-space: nowrap;
}

.pill.status-ready, .pill.status-success {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill.status-running {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill.status-failed {
  background: var(--bad-soft);
  color: var(--bad);
}

.pill.status-draft, .pill.status-invalid {
  background: var(--draft-soft);
  color: var(--muted);
}

.alert {
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
}

.alert.bad {
  background: var(--bad-soft);
  border: 1px solid rgba(255, 107, 122, 0.28);
}

.alert.ok-banner {
  background: var(--ok-soft);
  border: 1px solid rgba(61, 214, 140, 0.28);
  color: var(--text);
}

.alert.bad-banner {
  background: var(--bad-soft);
  border: 1px solid rgba(255, 107, 122, 0.28);
  color: var(--bad);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2.5rem 1rem;
}

body.page-login .wrap {
  max-width: none;
  padding: 0;
}

.login-card {
  width: min(100%, 24rem);
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 2.25rem 2rem 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.login-head {
  text-align: center;
  margin: 0;
  padding-bottom: 0;
}

.login-head h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}

.login-head p {
  margin: 0.65rem auto 0;
  max-width: 20rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

.login-error {
  margin: 0;
  text-align: center;
  font-size: 0.88rem;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-fields .login-submit {
  margin-top: 1rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.login-field > span:first-child {
  color: var(--muted);
  font-weight: 600;
}

.login-field input {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-field input::placeholder {
  color: #6b778c;
}

.login-field input:focus {
  outline: none;
  border-color: rgba(91, 157, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(91, 157, 255, 0.18);
}

.login-password-wrap {
  position: relative;
  display: block;
}

.login-password-wrap input {
  padding-right: 2.6rem;
}

.login-eye {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.login-eye:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  filter: none;
}

.login-eye svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.login-submit {
  width: 100%;
  margin: 0;
  min-height: 2.6rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.login-foot {
  margin: 0;
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 24rem;
}

.workflow-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
}

/* —— Job view page —— */
.job-page {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 1.35rem 1.4rem 1.4rem;
  box-shadow: var(--shadow);
}

.job-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.35rem;
}

.job-page-intro {
  min-width: 0;
  flex: 1 1 auto;
}

.job-page-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}

.job-page-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.job-page-meta {
  margin: 0.45rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.job-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex-shrink: 0;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.72rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  filter: none;
  white-space: nowrap;
}

a.btn-ghost:hover,
button.btn-ghost:hover {
  background: transparent;
  filter: none;
  text-decoration: none;
}

button.btn-ghost {
  background: transparent;
  font-weight: 500;
  padding: 0.38rem 0.72rem;
  border-radius: 8px;
}

.btn-ghost.btn-edit {
  border-color: rgba(91, 157, 255, 0.45);
  color: var(--accent);
}

.btn-ghost.btn-edit:hover {
  border-color: var(--accent);
  color: #8ebaff;
}

.btn-ghost.btn-neutral {
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost.btn-neutral:hover {
  border-color: #4a5568;
  color: #fff;
}

.btn-ghost.btn-danger {
  border-color: rgba(255, 107, 122, 0.4);
  color: var(--bad);
}

.btn-ghost.btn-danger:hover {
  border-color: var(--bad);
  color: #ff8a96;
}

.btn-table {
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  min-height: 28px;
}

.worker-action-form {
  display: inline-flex;
}

.json-card {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.json-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  border-bottom: 1px solid var(--border-soft);
}

.json-card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.json-viewer {
  background: #0a0c10;
}

.json-viewer-scroll {
  max-height: min(70vh, 640px);
  overflow: auto;
}

.json-code {
  margin: 0;
  padding: 0.85rem 1rem;
  font: 0.8125rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  white-space: pre;
  tab-size: 2;
}

.json-code .jk { color: #7ec8e3; }
.json-code .js { color: #9ece6a; }
.json-code .jn { color: #e5a84b; }
.json-code .jl { color: #b392f0; }
.json-code .jb { color: #79c0ff; }

.job-page .alert {
  margin-bottom: 1rem;
}

@media (max-width: 720px) {
  .job-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .job-page-actions {
    justify-content: flex-start;
  }
}

.editor-actions {
  margin-top: 1rem;
}

.alert ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.error-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.error-log pre,
#error-log-text {
  margin: 0;
  max-height: 28rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.82rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 107, 122, 0.18);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}

.btn-ghost.btn-sm {
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
}

.btn-copy-error {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font-weight: 600;
}

.btn-copy-error:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

pre:not(.json-code) {
  white-space: pre-wrap;
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

@media (max-width: 720px) {
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Remote screen viewer — same dashboard wrap width; stage fills leftover height. */
body:has(.screen-page) {
  overflow: hidden;
}

body:has(.screen-page) main.wrap {
  /* Keep normal max-width; only use remaining viewport height. */
  min-height: calc(100vh - 3.75rem);
  height: calc(100vh - 3.75rem);
  max-height: calc(100vh - 3.75rem);
  padding-top: 1rem;
  padding-bottom: 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.screen-page {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.screen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.screen-toolbar-left,
.screen-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.screen-title {
  margin: 0;
  font-size: 1.05rem;
}

.pill.status-viewers {
  gap: 0.35rem;
  background: var(--accent-soft);
  color: var(--accent);
}

.pill-ico {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.screen-action {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  font-size: 0.78rem;
  box-sizing: border-box;
  height: 2.1rem;
  min-height: 2.1rem;
  padding: 0 0.85rem;
  gap: 0.45rem;
}

.screen-control-btn {
  min-width: 2.1rem;
  padding: 0 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.screen-control-btn .screen-check {
  width: 0.95rem;
  height: 0.95rem;
  border: 1.5px solid var(--muted);
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  line-height: 0;
}

.screen-control-btn .screen-check::after {
  content: "";
  width: 0.42rem;
  height: 0.25rem;
  margin-top: -0.1rem;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg);
}

.screen-control-btn.is-on {
  background: var(--ok-soft);
  border-color: rgba(61, 214, 140, 0.45);
  color: var(--ok);
}

.screen-control-btn.is-on:hover {
  background: rgba(61, 214, 140, 0.22);
}

.screen-control-btn.is-on .screen-check {
  border-color: var(--ok);
  background: var(--ok);
}

.screen-control-btn.is-on .screen-check::after {
  border-left-color: #08111f;
  border-bottom-color: #08111f;
}

.screen-control-btn:not(.is-on) {
  color: var(--muted);
}

.screen-res-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-sizing: border-box;
  margin: 0;
  height: 2.1rem;
  min-height: 2.1rem;
  padding: 0 0.15rem 0 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  font-size: 0.78rem;
}

.screen-res-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1;
}

.screen-resolution {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text, #e8ecf4);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  height: 100%;
  min-height: 0;
  padding: 0 1.6rem 0 0.15rem;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa3b5' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
}

.screen-resolution option {
  background: #12151c;
  color: #e8ecf4;
}

.screen-action.is-on:not(.screen-control-btn) {
  background: var(--accent-soft);
  border-color: rgba(91, 157, 255, 0.45);
  color: var(--accent);
}

.screen-action.is-on:not(.screen-control-btn):hover {
  background: rgba(91, 157, 255, 0.2);
}

.screen-stage {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  background: #0b0d12;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.screen-stage:fullscreen {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: none;
  border-radius: 0;
  border: 0;
  background: #000;
}

#screen-frame {
  /* Sized by JS to fit the full remote desktop inside the stage. */
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
  background: #000;
  flex-shrink: 0;
}

#screen-frame.is-res-flash {
  animation: screen-res-flash 0.35s ease;
}

@keyframes screen-res-flash {
  0% { opacity: 0.35; }
  100% { opacity: 1; }
}

#screen-stream-size.is-pending {
  border-color: rgba(91, 157, 255, 0.45);
  color: var(--accent, #5b9dff);
}

.screen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.72);
  color: #c5ccd8;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.job-meta-list {
  display: grid;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  margin: 0;
}
.job-meta-list > div {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.75rem;
  align-items: start;
}
.job-meta-list dt {
  margin: 0;
  color: var(--muted, #6b7280);
  font-size: 0.85rem;
}
.job-meta-list dd {
  margin: 0;
  word-break: break-word;
}
