:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --line: #d9dee5;
  --text: #1f2933;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b91c1c;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
}

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

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: #111827;
  color: #fff;
}

.brand {
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav a,
.nav button {
  color: #e5e7eb;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.nav form {
  margin: 0;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto;
}

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

h1,
h2,
h3 {
  margin: 0 0 12px;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 17px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.metric,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.table-wrap {
  overflow-x: auto;
}

.metric .value {
  font-size: 28px;
  font-weight: 700;
}

.metric .label {
  color: var(--muted);
  margin-top: 4px;
}

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

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

th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.field.full {
  grid-column: 1 / -1;
}

.filters {
  align-items: end;
}

.actions-field {
  justify-content: end;
}

label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.actions.compact {
  margin-top: 10px;
}

.actions.full {
  grid-column: 1 / -1;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.inline-form select {
  min-width: 260px;
}

.stacked-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: var(--accent-strong);
}

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

.button.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 13px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
}

.badge.warn {
  background: #fff7ed;
  color: var(--warn);
}

.badge.danger {
  background: #fef2f2;
  color: var(--danger);
}

.flash {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.flash.error {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}

.muted {
  color: var(--muted);
}

.detail-list {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
}

.note {
  border-top: 1px solid var(--line);
  margin: 16px 0 0;
  padding-top: 12px;
  white-space: pre-wrap;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.pipeline-column {
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 180px;
}

.pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.pipeline-head h2 {
  font-size: 16px;
  margin: 0;
}

.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.pipeline-card h3,
.pipeline-card p {
  margin-bottom: 8px;
}

.card-facts {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 10px 0;
}

.card-facts dt {
  color: var(--muted);
  font-weight: 700;
}

.card-facts dd {
  margin: 0;
}

.stage-card-form {
  display: grid;
  gap: 8px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 6px;
}

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

  .grid.cols-2,
  .grid.cols-4,
  .form-grid,
  .pipeline {
    grid-template-columns: 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .container {
    width: min(100% - 20px, 1180px);
    margin-top: 16px;
  }
}
