:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #667085;
  --line: #d8dee8;
  --soft: #eef2f7;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --err: #dc2626;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}

button, input { font: inherit; }

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #0f766e);
}
.brand .name { letter-spacing: 0; }
.version { color: var(--muted); font-size: 12px; }

.container {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  grid-template-areas:
    "intro controls"
    "drop queue";
  gap: 18px;
  align-items: start;
}

.intro { grid-area: intro; }
.intro h1 {
  font-size: 26px;
  letter-spacing: 0;
  margin: 0 0 6px;
  font-weight: 700;
}
.intro p { color: var(--muted); margin: 0; max-width: 560px; }

.dropzone {
  grid-area: drop;
  min-height: 240px;
  background: var(--panel);
  border: 1.5px dashed #aab4c3;
  border-radius: 8px;
  padding: 28px 22px;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.dropzone:hover,
.dropzone:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.dropzone.drag {
  border-color: var(--accent);
  background: #eef5ff;
}

.dz-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 14px;
  border-radius: 8px;
  background: var(--accent);
  position: relative;
}
.dz-icon::before,
.dz-icon::after {
  content: "";
  position: absolute;
  background: var(--accent-ink);
  border-radius: 2px;
}
.dz-icon::before { left: 19px; top: 10px; width: 4px; height: 18px; }
.dz-icon::after { left: 12px; top: 17px; width: 18px; height: 4px; }

.dz-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.dz-sub { color: var(--muted); font-size: 13px; }
.dz-sub button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.controls {
  grid-area: controls;
  min-height: 72px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.summary { min-width: 0; display: grid; gap: 2px; }
.summary strong { font-size: 15px; }
.summary span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.queue {
  grid-area: queue;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  min-height: 150px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .55);
}

.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.item .name {
  font-weight: 650;
  overflow-wrap: anywhere;
}
.item .meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.item .right {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.item .status {
  min-width: 82px;
  text-align: center;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
}
.item.done .status { background: #e8f7ed; color: var(--ok); }
.item.error .status { background: #fdecec; color: var(--err); }
.item.run .status { background: #fff7e6; color: var(--warn); }

.bar {
  grid-column: 1 / -1;
  height: 5px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #0f766e);
  transition: width .2s ease;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.ghost:hover { background: var(--soft); border-color: #c7d0dd; }
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.icon-btn:hover { background: var(--soft); color: var(--ink); }

.report {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid #e6ebf2;
  padding: 10px 12px;
  border-radius: 7px;
  max-height: 180px;
  overflow: auto;
}
.report-head {
  color: var(--ink);
  font-weight: 650;
  margin-bottom: 6px;
}
.report pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.error-text { color: var(--err); background: #fff7f7; border-color: #ffd9d9; }

@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .container { padding: 20px 14px 48px; }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "drop"
      "controls"
      "queue";
  }
  .dropzone { min-height: 190px; }
  .controls {
    align-items: stretch;
    flex-direction: column;
  }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1; }
  .item { grid-template-columns: 1fr; }
  .item .right { justify-content: flex-start; }
}
