:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-wash: #fafbfc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-strong: #111827;
  --ink: #111827;
  --muted: #667085;
  --muted-strong: #475467;
  --line: #d9e0e8;
  --line-soft: #e8edf2;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #12805c;
  --red: #d92d20;
  --amber: #b54708;
  --violet: #7c3aed;
  --shadow: 0 16px 34px rgba(16, 24, 40, 0.08);
  --rail-bg: rgba(255, 255, 255, 0.9);
  --rail-border: rgba(217, 224, 232, 0.86);
  --brand-sheen: rgba(255, 255, 255, 0.82);
  --brand-border: rgba(255, 255, 255, 0.48);
  --success-soft: #ecfdf3;
  --success-line: #bbf7d0;
  --success-ink: #067647;
  --danger-soft: #fef3f2;
  --warning-soft: #fff7ed;
  --info-soft: #eff6ff;
  --neutral-soft: #f2f4f7;
  --focus-line: #9cc5ff;
  --focus-ring: rgba(37, 99, 235, 0.11);
  --button-bg: #111827;
  --button-border: #111827;
  --button-hover: #273244;
  --button-ink: #ffffff;
  --panel-head-bg: linear-gradient(180deg, #ffffff, #fbfcfd);
  --hover-bg: #fbfdff;
  --table-head-bg: #fbfcfd;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1720;
    --bg-wash: #172231;
    --surface: #151f2b;
    --surface-soft: #111a24;
    --surface-strong: #f8fafc;
    --ink: #eef4fb;
    --muted: #9aa8b7;
    --muted-strong: #c0cad5;
    --line: #2e3b49;
    --line-soft: #243140;
    --blue: #7ab4ff;
    --cyan: #45c7db;
    --green: #5fd39d;
    --red: #ff8d82;
    --amber: #f5b860;
    --violet: #b69cff;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
    --rail-bg: rgba(21, 31, 43, 0.9);
    --rail-border: rgba(70, 86, 104, 0.78);
    --brand-sheen: rgba(255, 255, 255, 0.5);
    --brand-border: rgba(255, 255, 255, 0.18);
    --success-soft: rgba(18, 128, 92, 0.18);
    --success-line: rgba(95, 211, 157, 0.36);
    --success-ink: #83e6b5;
    --danger-soft: rgba(217, 45, 32, 0.2);
    --warning-soft: rgba(181, 71, 8, 0.22);
    --info-soft: rgba(37, 99, 235, 0.2);
    --neutral-soft: #202b38;
    --focus-line: #65a7ff;
    --focus-ring: rgba(122, 180, 255, 0.18);
    --button-bg: #eef4fb;
    --button-border: #eef4fb;
    --button-hover: #d7e2ee;
    --button-ink: #111827;
    --panel-head-bg: linear-gradient(180deg, #172231, #151f2b);
    --hover-bg: #182635;
    --table-head-bg: #172231;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, var(--bg-wash) 0, rgba(250, 251, 252, 0) 360px),
    var(--bg);
  color: var(--ink);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.rail {
  position: sticky;
  top: 12px;
  z-index: 10;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid var(--rail-border);
  border-radius: 8px;
  background: var(--rail-bg);
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.07);
  backdrop-filter: blur(16px);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 0 43%, var(--brand-sheen) 43% 55%, transparent 55%),
    linear-gradient(135deg, #10b981, #2563eb 52%, #f59e0b);
  box-shadow: inset 0 0 0 1px var(--brand-border);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
  line-height: 1.1;
}

.brand span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
}

.nav a {
  min-width: 82px;
  color: var(--muted-strong);
  text-align: center;
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
}

.nav a:hover,
.nav a.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}

.rail-footer {
  justify-self: end;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.rail-footer span {
  max-width: 180px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--success-line);
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success-ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-footer span::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.workspace {
  min-width: 0;
  display: grid;
  gap: 16px;
  padding-top: 28px;
}

[data-view-panel][hidden] {
  display: none !important;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 2px 2px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.2;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  width: min(420px, 44vw);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
}

.search:focus-within {
  border-color: var(--focus-line);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.search span {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search input::placeholder {
  color: var(--muted);
}

#refresh {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--button-border);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--button-ink);
  font-weight: 800;
}

#refresh:hover {
  background: var(--button-hover);
}

#refresh span {
  font-size: 16px;
  line-height: 1;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  min-height: 108px;
  overflow: hidden;
  padding: 17px;
  display: grid;
  align-content: space-between;
}

.metric::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
  content: "";
}

.metric:nth-child(1)::before {
  background: var(--green);
}

.metric:nth-child(2)::before {
  background: var(--blue);
}

.metric:nth-child(3)::before {
  background: var(--amber);
}

.metric:nth-child(4)::before {
  background: var(--violet);
}

.metric span,
.panel-head span,
.signal span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  font-size: 31px;
  font-weight: 820;
  line-height: 1;
  letter-spacing: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-head-bg);
}

.queue-list {
  display: grid;
}

.queue-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 15px 17px 15px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.queue-item::before {
  position: absolute;
  inset: 12px auto 12px 10px;
  width: 3px;
  border-radius: 999px;
  background: var(--line);
  content: "";
}

.queue-item.Building::before {
  background: var(--blue);
}

.queue-item.Pending::before {
  background: var(--amber);
}

.queue-item.Done::before {
  background: var(--green);
}

.queue-item:last-child {
  border-bottom: 0;
}

.queue-item:hover {
  background: var(--hover-bg);
}

.pkg {
  min-width: 0;
}

.pkg strong,
.pkg span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pkg strong {
  font-size: 14px;
}

.pkg span {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  min-width: 82px;
  display: inline-flex;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
}

.pill.Successful,
.pill.Done {
  background: var(--success-soft);
  color: var(--green);
}

.pill.Failed {
  background: var(--danger-soft);
  color: var(--red);
}

.pill.Pending,
.pill.Staged {
  background: var(--warning-soft);
  color: var(--amber);
}

.pill.Building {
  background: var(--info-soft);
  color: var(--blue);
}

.pill.Skipped {
  background: var(--neutral-soft);
  color: var(--muted-strong);
}

.signal {
  display: grid;
  gap: 0;
}

.signal div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 16px 17px;
  border-bottom: 1px solid var(--line-soft);
}

.signal div:last-child {
  border-bottom: 0;
}

.signal strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.history-panel {
  overflow: hidden;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segmented button {
  height: 30px;
  min-width: 56px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
}

.segmented button:hover,
.segmented button.selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 3px 12px rgba(16, 24, 40, 0.09);
}

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

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

thead {
  background: var(--table-head-bg);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--table-head-bg);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

tbody tr:hover {
  background: var(--hover-bg);
}

td strong {
  font-weight: 820;
}

td a {
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.muted {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.empty,
.empty-row {
  padding: 28px 18px;
  color: var(--muted);
}

.empty-row {
  text-align: center;
}

@media (max-width: 980px) {
  .rail {
    grid-template-columns: 1fr auto;
  }

  .nav {
    order: 3;
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .nav a {
    flex: 1;
  }

  .rail-footer {
    justify-self: end;
  }

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

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .rail {
    position: static;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .rail-footer {
    justify-self: stretch;
    justify-content: space-between;
  }

  .rail-footer span {
    max-width: none;
  }

  .workspace {
    padding-top: 18px;
  }

  .topbar,
  .actions,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 29px;
  }

  .search {
    width: 100%;
  }

  #refresh {
    width: 100%;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .queue-item {
    grid-template-columns: 1fr auto;
  }

  .queue-item .muted {
    grid-column: 1 / -1;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    flex: 1;
    min-width: 0;
  }
}
