:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 36rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
}

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

button:hover,
a:hover {
  border-color: #c7d2fe;
  color: var(--blue);
}

a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  min-height: 37px;
  padding: 8px 12px;
  text-decoration: none;
}

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

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 52px);
  letter-spacing: -0.05em;
}

.subtitle {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.summary article,
.card,
.log-panel {
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.summary article {
  padding: 18px;
}

.summary span,
dt,
.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.section-title,
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 0 0 12px;
}

.section-title h2,
.panel-head h2 {
  margin: 0;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.filters,
.bulkbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.filters input,
.filters select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
}

.filters input {
  width: min(320px, 70vw);
}

.bulkbar {
  justify-content: space-between;
  margin: 0 0 14px;
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.bulkbar span {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.empty-card {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.card {
  min-width: 0;
  overflow: hidden;
  padding: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-header > div {
  min-width: 0;
}

.card h3 {
  overflow: hidden;
  margin-bottom: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-header p {
  overflow: hidden;
  margin-bottom: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  align-self: flex-start;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.running {
  background: #dcfce7;
  color: var(--green);
}

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

.badge.starting,
.badge.preparing {
  background: #fef3c7;
  color: var(--amber);
}

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

dl div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

dt {
  min-width: 0;
}

dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

dd.long {
  direction: rtl;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

dd.wrap {
  max-height: 4.4em;
  overflow: auto;
  text-align: left;
  white-space: normal;
  word-break: break-all;
}

.error {
  display: none;
  margin: 14px 0 0;
  border-radius: 12px;
  background: #fef2f2;
  color: var(--red);
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.error.visible {
  display: block;
}

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.actions button,
.actions a {
  min-width: 0;
  padding-inline: 8px;
  font-size: 13px;
}

.log-panel {
  margin-top: 24px;
  padding: 18px;
}

pre {
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border-radius: 14px;
  background: #0f172a;
  color: #d1d5db;
  padding: 16px;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .hero {
    display: block;
  }

  .toolbar {
    margin-top: 16px;
  }

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

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

  .filters,
  .bulkbar {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .summary,
  .grid {
    grid-template-columns: 1fr;
  }

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