:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172026;
  --muted: #64717a;
  --line: #d8e0e5;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

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

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 32px auto;
}

.topbar,
.panel,
.status-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

p,
label,
span {
  color: var(--muted);
}

.panel {
  margin-top: 16px;
  padding: 20px;
}

.controls,
.credentials-grid,
.admin-grid,
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.admin-grid {
  grid-template-columns: 1.1fr 1.4fr 1fr 120px auto;
  align-items: end;
}

.credentials-grid {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.status-grid {
  margin-top: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.active-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-grid article {
  padding: 16px;
}

.status-grid strong,
.sheet strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.sheet small,
.job-row small,
.admin-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  min-width: 92px;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2f3;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 13px;
}

.status-pill.running {
  background: #fff4cc;
  color: #7a4d00;
}

.status-pill.queued {
  background: #e8f1ff;
  color: #174ea6;
}

.status-pill.stopped,
.status-pill.failed {
  background: #fdecec;
  color: var(--danger);
}

.status-pill.completed {
  background: #e8f7ef;
  color: #107043;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 13px;
  font-weight: 700;
}

input,
select,
button {
  min-height: 42px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 48px;
}

button {
  border: 0;
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  background: #edf3f4;
  color: var(--text);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:hover {
  background: var(--primary-dark);
}

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

#stopBtn {
  background: var(--danger);
}

.actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet {
  margin-top: 16px;
}

.hidden {
  display: none;
}

pre {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101820;
  color: #e6edf3;
  line-height: 1.5;
  white-space: pre-wrap;
}

.jobs {
  display: grid;
  gap: 8px;
}

.job-row,
.admin-row {
  display: grid;
  grid-template-columns: 80px 1fr 120px 180px;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.admin-row {
  grid-template-columns: minmax(170px, 1fr) minmax(180px, 1.2fr) 90px 80px minmax(230px, auto);
}

.job-row button,
.admin-row button {
  min-height: 34px;
}

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

.admin-actions button {
  flex: 1 1 68px;
}

.admin-credentials {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.admin-credentials input,
.admin-credentials button {
  min-height: 34px;
}

.secondary-button {
  background: #edf3f4;
  color: var(--text);
}

.secondary-button:hover {
  background: #dbe6ea;
}

.danger-button {
  background: var(--danger);
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1080px);
    margin: 16px auto;
  }

  .topbar,
  .top-actions,
  .active-panel,
  .controls,
  .credentials-grid,
  .admin-grid,
  .status-grid,
  .job-row,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .admin-credentials {
    grid-template-columns: 1fr;
  }
}
