:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f4ef;
  --text: #17211b;
  --muted: #667064;
  --line: #d9dfd7;
  --accent: #1d6f59;
  --accent-strong: #124f42;
  --warn: #9a5b1f;
  --bad: #a43737;
  --blue: #255f85;
  --shadow: 0 12px 30px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 84px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 750;
}

h2 {
  font-size: 17px;
  font-weight: 720;
}

h3 {
  font-size: 13px;
  font-weight: 720;
  color: var(--muted);
  text-transform: uppercase;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
}

.status-strip,
.actions-row,
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  justify-content: space-between;
  min-height: 36px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-pill.ok {
  border-color: rgba(29, 111, 89, 0.35);
  background: rgba(29, 111, 89, 0.1);
  color: var(--accent-strong);
}

.status-pill.warn {
  border-color: rgba(154, 91, 31, 0.35);
  background: rgba(154, 91, 31, 0.1);
  color: var(--warn);
}

.status-pill.bad {
  border-color: rgba(164, 55, 55, 0.35);
  background: rgba(164, 55, 55, 0.1);
  color: var(--bad);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(520px, 1fr) minmax(320px, 420px);
  gap: 18px;
  padding: 18px;
}

.import-panel,
.jobs-panel,
.detail-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}

.upload-box {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.file-target {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  min-height: 76px;
  border: 1px dashed #aab6a7;
  border-radius: 8px;
  background: #fbfcfa;
  cursor: pointer;
  overflow: hidden;
}

.file-target-title {
  display: grid;
  place-items: center;
  height: 100%;
  background: #dfe9e1;
  color: var(--accent-strong);
  font-weight: 800;
}

.file-target-name {
  min-width: 0;
  padding: 0 14px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.form-row {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 10px;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.icon-button {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 20px;
}

.actions-row {
  margin-top: 12px;
}

.actions-row button {
  flex: 1;
}

.result-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

dl {
  margin: 0;
}

.result-panel dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

dd {
  margin: 3px 0 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-panel dd {
  font-size: 24px;
  font-weight: 780;
}

.jobs-table-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  position: sticky;
  top: 0;
  background: #eef3ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f4f8f4;
}

.cell-muted {
  color: var(--muted);
}

.detail-content {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.detail-list {
  display: grid;
  gap: 10px;
}

pre {
  max-height: 220px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111814;
  color: #e8f0e7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(460px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(280px, 380px) 1fr;
  }

  .detail-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar,
  .workspace {
    padding: 14px;
  }

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

  .status-strip {
    flex-wrap: wrap;
  }

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

  .actions-row {
    flex-direction: column;
  }

  .actions-row button {
    width: 100%;
  }
}
