:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #687385;
  --line: #d8dee8;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --danger: #b42318;
  --warning: #9a6700;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: white;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

button.secondary {
  background: white;
  color: var(--brand);
}

button.secondary:hover {
  background: #edf7f5;
}

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

button.danger:hover {
  background: #fff1f0;
}

input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: white;
  color: var(--text);
}

select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: white;
  color: var(--text);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.panel,
.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 18px;
}

.narrow {
  max-width: 420px;
}

.panel h2,
.view h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 8px;
  overflow-x: auto;
}

.tab {
  background: white;
  color: var(--text);
  border-color: transparent;
}

.tab.active {
  border-color: var(--brand);
  color: var(--brand);
  background: #edf7f5;
}

.view {
  padding: 16px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  padding-bottom: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #f9fafb;
  font-weight: 600;
}

td.wrap {
  white-space: normal;
  min-width: 180px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 150px;
}

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.status-line {
  min-height: 34px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  background: white;
}

.badge.enabled,
.badge.succeeded,
.badge.ok {
  color: var(--ok);
}

.badge.failed,
.badge.disabled,
.badge.stopped {
  color: var(--danger);
}

.badge.running,
.badge.queued {
  color: var(--warning);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 18px, 1400px);
    padding-top: 8px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }
}
