:root {
  --bg: #1e1a2c;
  --bg-header: #140b1a;
  --panel: rgba(255, 255, 255, 0.07);
  --panel-strong: rgba(255, 255, 255, 0.1);
  --panel-soft: rgba(255, 255, 255, 0.05);
  --text: #e8e9f0;
  --muted: rgba(232, 233, 240, 0.62);
  --line: rgba(237, 238, 248, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --primary: #9859bf;
  --primary-dark: #ab6bd4;
  --accent: #ab47ab;
  --danger: #ff6b7a;
  --warning: #ffc857;
  --success: #68d391;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.48);
  --gradient-main: radial-gradient(125.05% 148.1% at 41.68% 2.49%, #030509 48.58%, #3d1747 69.27%, #1e1a2c 100%);
  --stella-gradient: linear-gradient(135deg, #be8cbe 0%, #ab47ab 50%, #613b7a 100%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--gradient-main);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--bg-header);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 32px;
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  gap: 12px;
  min-width: 0;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--stella-gradient);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.brand small,
.meta,
.muted,
.section-heading p,
.lede {
  color: var(--muted);
}

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

.brand small {
  font-size: 12px;
  margin-top: 1px;
}

.topbar-actions,
.header-actions,
.project-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-actions form {
  margin: 0;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.user-pill,
.count-pill {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  line-height: 1;
  padding: 7px 10px;
}

.runner-strip {
  background: rgba(20, 11, 26, 0.88);
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.runner-strip-inner {
  align-items: flex-start;
  display: flex;
  gap: 18px 28px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1180px;
  padding: 14px 32px;
}

.runner-summary {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.runner-title-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.runner-human-status {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-width: 0;
}

.runner-activity-spinner {
  animation: spin 0.9s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  border-top-color: var(--primary);
  display: inline-block;
  flex: 0 0 auto;
  height: 16px;
  width: 16px;
}

.runner-human-status [data-runner-primary] {
  color: var(--text);
  font-weight: 650;
}

.runner-metrics {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px 12px;
  justify-content: flex-end;
  max-width: 520px;
  min-width: 260px;
  text-align: right;
}

.runner-error-link {
  color: var(--danger);
  font-weight: 700;
  white-space: nowrap;
}

.runner-error {
  color: var(--danger);
  font-weight: 650;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  border-radius: 999px;
  display: inline-block;
  height: 9px;
  width: 9px;
}

.status-idle {
  background: var(--success);
}

.status-running {
  background: var(--accent);
}

.status-warning {
  background: var(--warning);
}

.content {
  margin: 0 auto;
  max-width: 1180px;
  padding: 32px;
}

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

.page-header h1,
.login-copy h1 {
  font-size: 32px;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 0;
}

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

.button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 650;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
}

.button:hover:not(:disabled) {
  background: rgba(152, 89, 191, 0.2);
  border-color: rgba(190, 140, 190, 0.35);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-primary {
  background: #613a79;
  border-color: #7a4a91;
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: #7a4a91;
}

.button-ghost {
  background: transparent;
}

.button-sm {
  font-size: 13px;
  min-height: 32px;
  padding: 6px 10px;
}

.button-full {
  display: flex;
  justify-content: center;
  width: 100%;
}

.section-block,
.login-panel,
.archived-panel,
.summary-tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-block {
  margin-bottom: 22px;
  overflow: hidden;
}

.section-heading {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 20px;
}

.section-heading-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.section-heading h2 {
  font-size: 18px;
  margin: 0;
}

.section-heading p {
  margin: 3px 0 0;
}

.collapsible-section > summary {
  cursor: pointer;
  list-style: none;
}

.collapsible-section > summary::-webkit-details-marker {
  display: none;
}

.collapsible-section:not([open]) > .section-heading {
  border-bottom: 0;
}

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

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

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

th {
  background: rgba(20, 11, 26, 0.82);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(152, 89, 191, 0.16);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.numeric {
  text-align: right;
}

.cell-spinner {
  animation: spin 0.9s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  border-top-color: var(--primary);
  display: inline-block;
  height: 16px;
  vertical-align: middle;
  width: 16px;
}

.row-link {
  color: var(--text);
  font-weight: 700;
}

.actions-cell {
  text-align: right;
  white-space: nowrap;
}

.badge {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.badge-new,
.badge-status-no,
.badge-status-unknown {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted);
}

.badge-active,
.badge-status-yes {
  background: rgba(76, 175, 80, 0.14);
  border-color: rgba(104, 211, 145, 0.24);
  color: var(--success);
}

.badge-status-complete {
  background: rgba(76, 175, 80, 0.14);
  border-color: rgba(104, 211, 145, 0.24);
  color: var(--success);
}

.badge-archived {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.badge-status-failed {
  background: rgba(220, 53, 69, 0.16);
  border-color: rgba(255, 107, 122, 0.32);
  color: var(--danger);
}

.badge-status-pending,
.badge-status-queued,
.badge-status-requested {
  background: rgba(255, 193, 7, 0.14);
  border-color: rgba(255, 200, 87, 0.32);
  color: var(--warning);
}

.badge-status-running {
  background: rgba(152, 89, 191, 0.18);
  border-color: rgba(190, 140, 190, 0.34);
  color: var(--accent);
}

.badge-status-no_speech {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  padding: 24px 20px;
}

.error-detail {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  max-width: 460px;
  overflow-wrap: anywhere;
}

.archived-panel {
  margin-top: 28px;
  overflow: hidden;
}

.archived-panel summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 700;
  gap: 10px;
  justify-content: space-between;
  list-style: none;
  padding: 16px 20px;
}

.archived-panel summary::-webkit-details-marker {
  display: none;
}

.archived-content {
  border-top: 1px solid var(--line);
}

.login-layout {
  align-items: center;
  display: grid;
  gap: 48px;
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: calc(100vh - 132px);
}

.login-copy {
  max-width: 620px;
}

.login-copy h1 {
  font-size: 42px;
}

.lede {
  font-size: 17px;
  margin: 18px 0 0;
}

.login-panel {
  padding: 28px;
}

.login-panel h2 {
  font-size: 22px;
  margin: 0 0 18px;
}

.login-divider {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 10px;
  margin: 18px 0;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  background: var(--line);
  content: "";
  flex: 1;
  height: 1px;
}

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

.form-stack label {
  color: var(--text);
  display: grid;
  font-weight: 700;
  gap: 7px;
}

.form-stack input,
.form-stack textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 7px;
  min-height: 42px;
  padding: 9px 11px;
}

.form-stack textarea {
  resize: vertical;
}

.form-stack input:focus,
.form-stack textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(152, 89, 191, 0.22);
  outline: none;
}

.form-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.flash {
  border-radius: 7px;
  font-weight: 650;
  padding: 10px 12px;
}

.flash-error {
  background: rgba(220, 53, 69, 0.16);
  border: 1px solid rgba(255, 107, 122, 0.32);
  color: var(--danger);
}

.flash-success {
  background: rgba(76, 175, 80, 0.14);
  border: 1px solid rgba(104, 211, 145, 0.24);
  color: var(--success);
}

.progress-modal {
  align-items: center;
  background: rgba(3, 5, 9, 0.82);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 20;
}

.progress-modal.is-open {
  display: flex;
}

.progress-modal.has-error .progress-spinner {
  animation: none;
  border-color: rgba(255, 107, 122, 0.32);
  border-top-color: var(--danger);
}

.progress-modal-panel {
  align-items: flex-start;
  background: #201728;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 18px;
  max-width: 520px;
  padding: 22px;
  width: 100%;
}

.progress-modal-panel h2 {
  font-size: 20px;
  line-height: 1.2;
  margin: 0 0 6px;
}

.progress-modal-panel p {
  color: var(--muted);
  margin: 0;
}

.progress-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.progress-stats span {
  background: #2a2034;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 5px;
  padding: 7px 9px;
}

.progress-stats strong {
  color: var(--text);
}

.progress-spinner {
  animation: spin 0.9s linear infinite;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--primary);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 28px;
  margin-top: 2px;
  width: 28px;
}

.progress-steps {
  color: var(--muted);
  margin: 14px 0 0;
  padding-left: 20px;
}

.progress-steps li + li {
  margin-top: 5px;
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.breadcrumb {
  align-items: center;
  color: var(--muted);
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.project-header {
  margin-bottom: 18px;
}

.project-meta {
  color: var(--muted);
  margin-top: 10px;
}

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

.summary-tile {
  box-shadow: none;
  padding: 16px;
}

.summary-tile span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.summary-tile strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.file-name {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.artifact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 300px;
}

.artifact-list a {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.recipient-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 20px;
}

.recipient-pill {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  padding: 7px 10px;
}

.recipient-pill small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

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

  .topbar {
    padding: 16px 20px;
  }

  .runner-strip-inner,
  .content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .runner-metrics {
    justify-content: flex-start;
    max-width: none;
    min-width: 0;
    text-align: left;
  }

  .login-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-copy h1,
  .page-header h1 {
    font-size: 30px;
  }

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

@media (max-width: 520px) {
  .topbar-actions,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .topbar-actions form {
    width: 100%;
  }

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