:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --ink: #17191f;
  --muted: #6b7280;
  --line: #d9dee8;
  --accent: #2158d6;
  --accent-weak: #e8eefc;
  --danger: #b42318;
  --ok: #166534;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.check-label {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.check-label input {
  width: 16px;
  min-height: 16px;
}

button {
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.secondary.selected-action {
  background: var(--accent);
  color: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
}

.auth-strip {
  display: grid;
  grid-template-columns: minmax(180px, 360px) auto auto auto;
  gap: 8px;
  align-items: center;
}

.auth-status {
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.status-line.error {
  color: var(--danger);
}

.status-line.ok {
  color: var(--ok);
}

.auth-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 220px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
}

.auth-gate h2 {
  font-size: 24px;
  line-height: 1.15;
}

.auth-gate p:last-child {
  max-width: 460px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.metrics div {
  background: var(--surface);
  padding: 14px;
}

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

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.side-panel,
.main-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.side-panel {
  padding: 16px;
}

.side-panel h2 + form,
.side-panel form + h2 {
  margin-top: 16px;
}

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

.form-stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.main-panel {
  min-width: 0;
  padding: 16px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.catalog-toolbar {
  margin-top: 18px;
}

.muted-copy {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 300px) 120px;
  gap: 8px;
}

.filters.compact {
  grid-template-columns: minmax(150px, 1fr) 150px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.table-frame {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-frame.short {
  max-height: 300px;
}

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

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

th {
  background: #fbfcff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

tr.selected-row td {
  background: #eef4ff;
}

.mono,
td.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
}

.tier {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.tier.pro {
  background: #fef3c7;
  color: #92400e;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
  margin-top: 18px;
}

.split h2 {
  margin-bottom: 0;
}

.activity-section {
  margin-top: 18px;
}

.event-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.event {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 13px;
}

.event strong {
  display: block;
  margin-bottom: 4px;
}

.event span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.manage-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.download-history {
  margin-top: 14px;
}

.download-history h2 {
  margin-bottom: 10px;
}

.artifact-history-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

.artifact-history-list > span {
  color: var(--muted);
  font-size: 13px;
}

.artifact-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.artifact-history-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.artifact-history-row strong {
  white-space: nowrap;
  font-size: 12px;
}

.artifact-stack {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.artifact-stack span {
  display: block;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.blocked {
  background: #fee2e2;
  color: #991b1b;
}

.progress-shell {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

@media (max-width: 980px) {
  .topbar,
  .workspace,
  .split {
    grid-template-columns: 1fr;
    display: grid;
  }

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

  .auth-gate {
    align-items: stretch;
    flex-direction: column;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .section-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .event-list {
    grid-template-columns: 1fr;
  }
}
