:root { color-scheme: dark; }

body { font-feature-settings: "ss01", "cv11"; }

.card {
  background: rgb(15 21 48 / 0.6);
  border: 1px solid rgb(30 41 79 / 0.8);
  border-radius: 12px;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid rgb(30 41 79 / 0.8);
  background: rgb(20 27 58 / 0.5);
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgb(148 163 184);
}

.card-body {
  padding: 0.9rem;
  transition: max-height 220ms ease, padding 220ms ease, opacity 160ms ease;
}

.card[data-collapsed="true"] .card-body {
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.chevron {
  margin-left: auto;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.375rem;
  font-size: 0.7rem;
  color: rgb(148 163 184);
  background: transparent;
  border: 1px solid transparent;
  transition: background 120ms ease, transform 200ms ease, color 120ms ease;
  cursor: pointer;
}

.chevron:hover { background: rgb(30 41 79); color: rgb(226 232 240); }
.card[data-collapsed="true"] .chevron { transform: rotate(-90deg); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-pill::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  background: currentColor;
}

.status-success { background: rgb(16 185 129 / 0.15); color: rgb(110 231 183); }
.status-running { background: rgb(59 130 246 / 0.15); color: rgb(147 197 253); }
.status-failed  { background: rgb(239 68 68 / 0.18); color: rgb(252 165 165); }
.status-timeout { background: rgb(217 119 6 / 0.18); color: rgb(252 211 77); }
.status-stopping { background: rgb(168 85 247 / 0.18); color: rgb(216 180 254); }
.status-unknown { background: rgb(71 85 105 / 0.4); color: rgb(203 213 225); }

.banner-info    { background: rgb(59 130 246 / 0.12); color: rgb(147 197 253); border: 1px solid rgb(59 130 246 / 0.3); }
.banner-warn    { background: rgb(245 158 11 / 0.12); color: rgb(253 224 71); border: 1px solid rgb(245 158 11 / 0.3); }
.banner-error   { background: rgb(239 68 68 / 0.12); color: rgb(252 165 165); border: 1px solid rgb(239 68 68 / 0.3); }

.scope-chip {
  font-size: 0.7rem;
  padding: 0.2rem 0.7rem;
  border-radius: 9999px;
  background: rgb(20 27 58 / 0.7);
  border: 1px solid rgb(30 41 79);
  color: rgb(203 213 225);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.scope-chip:hover { background: rgb(27 35 71); color: rgb(226 232 240); }

.scope-chip[data-active="true"] {
  background: rgb(59 130 246 / 0.2);
  border-color: rgb(59 130 246 / 0.5);
  color: rgb(191 219 254);
}

.context-select {
  background: rgb(20 27 58 / 0.7);
  color: rgb(226 232 240);
  border: 1px solid rgb(30 41 79);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  cursor: pointer;
  transition: border-color 120ms ease;
}

.context-select:hover:not(:disabled) { border-color: rgb(59 130 246 / 0.5); }
.context-select:focus { outline: none; border-color: rgb(59 130 246); }
.context-select option { background: rgb(15 21 48); color: rgb(226 232 240); }

.cluster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  align-items: start;
}

.cluster-grid-col {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

@media (max-width: 1180px) {
  .cluster-grid {
    grid-template-columns: 1fr;
  }
}

.cluster-box {
  background: rgb(15 21 48 / 0.55);
  border: 1px solid rgb(30 41 79 / 0.7);
  border-radius: 10px;
  overflow: hidden;
  min-width: 0;
}

.cluster-box-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: rgb(20 27 58 / 0.6);
  border-bottom: 1px solid rgb(30 41 79 / 0.7);
}

.cluster-box-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgb(191 219 254);
}

.cluster-box-subtitle {
  font-size: 0.65rem;
  color: rgb(100 116 139);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.cluster-box-counts {
  margin-left: auto;
  font-size: 0.65rem;
  color: rgb(148 163 184);
}

.cluster-box table {
  width: 100%;
  font-size: 0.85rem;
  table-layout: auto;
}

.cluster-box thead {
  background: rgb(20 27 58 / 0.35);
}

.cluster-box thead th {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgb(100 116 139);
  font-weight: 600;
  text-align: left;
  padding: 0.4rem 0.6rem;
}

.pipe-row {
  border-top: 1px solid rgb(30 41 79 / 0.45);
}

.pipe-row:hover {
  background: rgb(20 27 58 / 0.45);
}

.pipe-row td {
  padding: 0.45rem 0.6rem;
}

.pipe-row td.region-cell {
  font-weight: 600;
  color: rgb(226 232 240);
}

.pipe-row td.lastrun-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  color: rgb(148 163 184);
  word-break: break-all;
}

.pipe-row td.started-cell, .pipe-row td.duration-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  color: rgb(203 213 225);
}

.pipe-row[data-expanded="true"] {
  background: rgb(20 27 58 / 0.6);
}

.taskruns-row td {
  padding: 0 0.75rem 0.75rem 2rem;
  background: rgb(15 21 48 / 0.4);
  font-size: 0.75rem;
}

/*
  Inline failed-task list pinned under a failed pipelinerun. Empty leading
  cell aligns the list with the "Last PipelineRun" column, matching the
  bash script's intent but anchored to the run name rather than the region.
*/
.inline-failed-row {
  background: rgb(20 27 58 / 0.25);
}

.inline-failed-row td.inline-failed-spacer {
  padding: 0;
  background: transparent;
  border-top: none;
}

.inline-failed-row td.inline-failed-cell {
  padding: 0.15rem 0.6rem 0.45rem 0.6rem;
  border-top: none;
}

.inline-failed-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  line-height: 1.4;
  cursor: pointer;
}

.inline-failed-line:hover {
  background: rgb(27 35 71 / 0.6);
}

.inline-failed-line.muted {
  color: rgb(100 116 139);
  font-style: italic;
  cursor: default;
}

.inline-failed-line.muted:hover { background: transparent; }

.inline-failed-arrow {
  flex: 0 0 1rem;
  color: rgb(100 116 139);
  text-align: center;
}

.inline-failed-name {
  flex: 0 1 auto;
  min-width: 0;
  color: rgb(252 165 165);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-failed-reason {
  flex: 0 0 auto;
  color: rgb(148 163 184);
}

.taskrun-line {
  display: grid;
  grid-template-columns: 1fr 6rem 1fr;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  cursor: pointer;
}

.taskrun-line:hover {
  background: rgb(27 35 71 / 0.5);
}

.event-line { padding: 0.15rem 0.4rem; border-radius: 4px; color: rgb(226 232 240); }

.btn-row-action {
  font-size: 0.7rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  background: rgb(71 85 105 / 0.4);
  color: rgb(203 213 225);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.btn-row-action:hover { background: rgb(71 85 105 / 0.7); color: rgb(226 232 240); }

.btn-row-action.danger {
  background: rgb(239 68 68 / 0.15);
  color: rgb(252 165 165);
  border-color: rgb(239 68 68 / 0.3);
}

.btn-row-action.danger:hover { background: rgb(239 68 68 / 0.3); color: rgb(254 226 226); }

.btn-row-action:disabled { opacity: 0.4; cursor: not-allowed; }

#delete-modal.show, #logs-modal.show { display: flex; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgb(30 41 79); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgb(51 65 110); }
::-webkit-scrollbar-track { background: transparent; }
