:root {
  color-scheme: light;
  --ink: #1f2925;
  --muted: #66716c;
  --line: #d9dfdc;
  --soft: #f3f6f4;
  --green: #176b4d;
  --green-dark: #0f5039;
  --amber: #a56500;
  --red: #a43d36;
  --white: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #eef2f0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button, input { font: inherit; }

.hidden { display: none !important; }

.topbar {
  min-height: 76px;
  padding: 16px max(24px, calc((100vw - 1400px) / 2));
  color: var(--white);
  background: #25332d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.topbar p {
  margin: 5px 0 0;
  color: #cdd7d2;
  font-size: 13px;
}

.workspace {
  width: min(1400px, calc(100% - 32px));
  margin: 20px auto 40px;
  display: grid;
  gap: 16px;
}

.upload-panel,
.task-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.upload-panel { padding: 22px; }
.task-panel { overflow: hidden; }
.task-panel .section-heading { padding: 18px 20px; }

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

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

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

.status-chip {
  border: 1px solid #b9cec4;
  color: var(--green);
  background: #eef7f2;
  border-radius: 4px;
  padding: 6px 9px;
  white-space: nowrap;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(180px, 1fr);
  gap: 16px;
}

label > span {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
}

input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid #bfc8c3;
  border-radius: 4px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, .11);
}

.drop-zone {
  margin-top: 16px;
  min-height: 106px;
  padding: 22px;
  border: 1px dashed #98aaa1;
  background: var(--soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.drop-zone:hover { border-color: var(--green); }
.drop-zone input { display: none; }
.drop-zone strong { font-size: 15px; }
.drop-zone span { margin: 7px 0 0; color: var(--muted); font-weight: 400; }

.file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.file-item {
  min-width: 0;
  border: 1px solid var(--line);
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.file-item > span { color: var(--green); font-weight: 700; }
.file-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item small { color: var(--muted); }

.form-actions {
  min-height: 44px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.form-message { margin: 0; color: var(--red); }

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 15px;
  cursor: pointer;
}

.button.primary {
  color: var(--white);
  background: var(--green);
}

.button.primary:hover { background: var(--green-dark); }
.button:disabled { opacity: .55; cursor: wait; }

.button.secondary {
  color: var(--ink);
  border-color: #b7c0bc;
  background: var(--white);
}

.button.full { width: 100%; }

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

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

th {
  padding: 11px 14px;
  color: #4c5852;
  background: #edf1ef;
  text-align: left;
  font-weight: 700;
  white-space: nowrap;
}

td {
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

td strong, td small { display: block; }
td small { margin-top: 5px; color: var(--muted); }

.state {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 3px;
  font-weight: 700;
}

.state.queued { color: #5d6661; background: #edf0ee; }
.state.running { color: #8a5909; background: #fff3da; }
.state.completed { color: var(--green); background: #e8f5ee; }
.state.failed { color: var(--red); background: #fae9e7; }

.progress {
  width: 150px;
  height: 7px;
  margin-top: 6px;
  overflow: hidden;
  background: #e4e9e6;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--green);
}

.actions { white-space: nowrap; }

.table-action {
  border: 0;
  padding: 0;
  margin-right: 12px;
  color: #48534e;
  background: transparent;
  text-decoration: underline;
  cursor: pointer;
}

.primary-link { color: var(--green); font-weight: 700; }
.task-error { max-width: 360px; margin-top: 7px; color: var(--red); font-size: 12px; }
.empty-state { padding: 46px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); }

.login-screen {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(390px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.login-box h2 { margin: 0; font-size: 20px; }
.login-box > p { margin: 7px 0 20px; color: var(--muted); }
.login-box .form-message { min-height: 22px; margin: 8px 0; color: var(--red); }

dialog {
  width: min(1000px, calc(100% - 32px));
  max-height: calc(100vh - 60px);
  padding: 0;
  border: 1px solid #aeb8b3;
  border-radius: 6px;
}

dialog::backdrop { background: rgba(21, 29, 25, .55); }

.dialog-heading {
  height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-heading h2 { margin: 0; font-size: 17px; }

.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  color: #59635e;
  background: transparent;
  font-size: 25px;
  cursor: pointer;
}

pre {
  max-height: calc(100vh - 150px);
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #d8e2dd;
  background: #202923;
  font: 12px/1.6 Consolas, monospace;
  white-space: pre-wrap;
}

@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .topbar p { display: none; }
  .workspace { width: calc(100% - 20px); margin-top: 10px; }
  .upload-panel { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: center; }
  .section-heading p { display: none; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button { width: 100%; }
}
