:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-muted: #eef2f4;
  --text: #1b2528;
  --muted: #627176;
  --line: #d8e0e3;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --danger: #b91c1c;
  --shadow: 0 10px 30px rgba(25, 42, 52, 0.08);
}

* {
  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;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
}

button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

button:disabled {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 42px);
  background: #172326;
  color: white;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: 0;
}

.topbar p {
  color: #c7d5d8;
}

.toolbar {
  display: flex;
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 42px) 42px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

.panel.wide {
  grid-column: 1 / -1;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 1.08rem;
  letter-spacing: 0;
}

.section-heading p,
.meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.list,
.task-list,
.audit-list {
  display: grid;
  gap: 10px;
}

.empty {
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.item-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.repo-meta,
.task-meta,
.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.review-controls {
  display: grid;
  gap: 10px;
  padding-top: 6px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.run-diagnostics {
  display: grid;
  gap: 8px;
}

.run-diagnostics summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 650;
}

.run-diagnostics dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.run-diagnostics dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.run-diagnostics dd {
  margin: 0;
  min-width: 0;
}

.run-diagnostics pre {
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
  color: var(--text);
  font-size: 0.82rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 650;
}

.badge.ready {
  background: #dff5ef;
  color: var(--accent-strong);
}

.badge.warning {
  background: #fff2d9;
  color: var(--amber);
}

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

.task-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.span-2 {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--text);
}

.audit-event {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.audit-event:last-child {
  border-bottom: 0;
}

.audit-type {
  font-weight: 750;
}

.audit-payload {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #172326;
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .topbar,
  .section-heading,
  .item-header {
    align-items: stretch;
    flex-direction: column;
  }

  .layout,
  .task-form {
    grid-template-columns: 1fr;
  }

  .audit-event {
    grid-template-columns: 1fr;
  }
}
