:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #65706a;
  --line: #d9dfd9;
  --paper: #fbfbf8;
  --panel: #ffffff;
  --pine: #1f6f53;
  --pine-dark: #174f3d;
  --blue: #315f8c;
  --amber: #9a6a18;
  --red: #a53a32;
  --soft-green: #e8f2eb;
  --soft-blue: #e8eef5;
  --soft-amber: #fbf1da;
  --shadow: 0 20px 50px rgba(23, 33, 27, 0.09);
  --radius: 8px;
  font-family: Aptos, "Segoe UI", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(31, 111, 83, 0.08) 0, transparent 36%),
    linear-gradient(180deg, #f4f6f2 0, #fbfbf8 48%, #eef3f6 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(31, 111, 83, 0.14);
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-mark {
  display: inline-grid;
  min-width: 72px;
  min-height: 42px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.login-panel h1,
.topbar h1,
.section-header h2,
.detail-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.login-panel h1 {
  margin-top: 18px;
  font-size: 30px;
}

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

.form-error {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--red);
  font-size: 14px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  background: #17211b;
  color: #fff;
  padding: 22px 16px;
}

.brand-line {
  font-size: 24px;
  font-weight: 850;
}

.env-chip {
  display: inline-flex;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 5px 9px;
  color: #d9ede4;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin: 34px 0;
}

.nav-item,
.ghost-button {
  width: 100%;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  padding: 11px 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.user-box {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 14px;
}

.user-box span,
.user-box small {
  display: block;
}

.user-box small {
  margin-top: 3px;
  color: #b8c8c0;
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  text-align: center;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  font-size: 27px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 6px;
  padding: 10px 15px;
  font-weight: 750;
}

.primary-button {
  background: var(--pine);
  color: #fff;
}

.primary-button:hover {
  background: var(--pine-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.compact {
  min-width: 86px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.metric-block {
  border: 1px solid var(--line);
  border-left: 4px solid var(--pine);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  padding: 14px 16px;
}

.metric-block:nth-child(2) {
  border-left-color: var(--blue);
}

.metric-block:nth-child(3) {
  border-left-color: var(--amber);
}

.metric-block span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.metric-block strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(20px, 3vw, 30px);
}

.section-view {
  display: grid;
  gap: 14px;
}

.section-header h2 {
  font-size: 20px;
}

.inline-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-form,
.run-grid {
  display: grid;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  padding: 14px;
}

.toolbar-form {
  grid-template-columns: minmax(180px, 1.4fr) minmax(160px, 0.8fr) auto;
}

.run-grid {
  grid-template-columns: 150px minmax(220px, 1fr) minmax(220px, 1fr) 140px auto;
}

.file-run-grid {
  grid-template-columns: 150px repeat(3, minmax(160px, 1fr)) 130px;
}

.file-run-grid .check-group {
  grid-column: span 2;
}

.file-run-grid button {
  align-self: end;
}

.file-picker {
  position: relative;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.file-picker span {
  display: grid;
  min-height: 42px;
  align-items: center;
  margin: 0;
  overflow: hidden;
  border: 1px dashed var(--pine);
  border-radius: 6px;
  background: var(--soft-green);
  color: var(--pine-dark);
  padding: 9px 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
}

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

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

th {
  background: #eef3ef;
  color: #344039;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

tbody tr:hover {
  background: #f8faf8;
}

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

.mono {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  min-width: 74px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 750;
}

.status-uploaded,
.status-completed {
  background: var(--soft-green);
  color: var(--pine-dark);
}

.status-running,
.status-queued {
  background: var(--soft-blue);
  color: var(--blue);
}

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

.status-failed {
  background: #f8e2df;
  color: var(--red);
}

.runs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
}

.detail-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  padding: 14px;
}

.detail-panel h3 {
  font-size: 16px;
}

.check-group > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.check-list {
  display: grid;
  max-height: 148px;
  gap: 7px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.check-list label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  border-radius: 5px;
  padding: 5px 6px;
}

.check-list label:hover {
  background: #f4f7f4;
}

.check-list input {
  min-height: auto;
  margin-top: 2px;
  padding: 0;
}

.check-list small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.export-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf8;
  padding: 8px;
}

.export-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

pre {
  max-height: 420px;
  overflow: auto;
  margin: 12px 0 0;
  border-radius: 6px;
  background: #17211b;
  color: #eaf3ee;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.link-button {
  border-radius: 6px;
  background: var(--soft-blue);
  color: var(--blue);
  padding: 7px 10px;
  font-weight: 750;
}

.danger-button {
  border-radius: 6px;
  background: #f8e2df;
  color: var(--red);
  padding: 7px 10px;
  font-weight: 750;
}

.danger-button:hover {
  background: #f1cbc6;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  transform: translateY(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

  .nav-list {
    grid-auto-flow: column;
    margin: 0;
  }

  .sidebar-footer {
    margin-left: auto;
  }

  .runs-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .login-panel,
  .workspace {
    padding: 18px;
  }

  .sidebar {
    display: grid;
    padding: 16px;
  }

  .nav-list {
    grid-auto-flow: row;
  }

  .topbar,
  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-row,
  .toolbar-form,
  .run-grid {
    grid-template-columns: 1fr;
  }

  .file-run-grid .check-group {
    grid-column: auto;
  }
}
