:root {
  color-scheme: light;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --text: #17211d;
  --muted: #64716c;
  --line: #dce4df;
  --primary: #176b4d;
  --primary-dark: #0f513a;
  --danger: #b83232;
  --warning: #a85f00;
  --shadow: 0 10px 30px rgba(28, 45, 38, 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;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  letter-spacing: 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 780px;
  margin: 12px auto 0;
  padding: 0 16px;
}

.tabs a,
.filters a {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.tabs a.active,
.filters a.active {
  border-color: var(--primary);
  color: var(--primary);
}

.page {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 22px 16px 48px;
}

.auth-panel,
.task-form,
.content-block,
.metadata,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  margin: 8vh auto 0;
  max-width: 440px;
  padding: 24px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

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

.date {
  margin: 8px 0 0;
  font-size: 13px;
}

.alert {
  margin: 16px 0;
  padding: 12px;
  border-radius: 8px;
  background: #fff1f1;
  color: var(--danger);
  font-weight: 700;
}

.form-stack,
.task-form {
  display: grid;
  gap: 16px;
}

.task-form {
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #33413b;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  border: 1px solid #cbd8d2;
  border-radius: 8px;
  background: white;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

button,
.primary-link,
.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-align: center;
}

.primary-button,
.primary-link {
  background: var(--primary);
  color: white;
}

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

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

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

.section-heading {
  margin-bottom: 18px;
}

.row-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.task-card-main {
  min-width: 0;
}

.task-card h2 {
  margin: 8px 0 6px;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf3f0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.status.running {
  background: #fff7e8;
  color: var(--warning);
}

.status.failed,
.status.canceled {
  background: #fff1f1;
  color: var(--danger);
}

.status.completed {
  background: #e8f7ef;
  color: var(--primary);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.metadata {
  padding: 16px;
}

dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: -6px 0 0;
  overflow-wrap: anywhere;
}

.content-block {
  padding: 16px;
  margin-bottom: 14px;
}

.output-box {
  width: 100%;
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: #202b27;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
}

.error-text {
  background: #fff8f8;
  color: var(--danger);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-state {
  padding: 24px;
  text-align: center;
}

@media (max-width: 680px) {
  .topbar {
    padding-inline: 14px;
  }

  .row-heading,
  .task-card,
  .detail-grid {
    display: grid;
  }

  .task-card .secondary-button,
  .primary-link,
  .action-row > *,
  .action-row button,
  .action-row a {
    width: 100%;
  }

  .filters {
    grid-template-columns: repeat(5, 112px);
  }
}
