* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  min-width: 0;
  margin: 0;
  background: #f3f5f8;
  color: #111827;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #d6dce5;
  background: #fff;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

#statusText {
  margin: 4px 0 0;
  color: #64748b;
}

.manual {
  flex: 1 1 460px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  max-width: 640px;
}

input,
button {
  height: 34px;
  border: 1px solid #b8c2d0;
  border-radius: 4px;
  background: #fff;
  color: #111827;
  font: inherit;
}

input {
  min-width: 0;
  padding: 0 10px;
}

button {
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: #2563eb;
}

button:disabled {
  cursor: default;
  opacity: .5;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 22px;
  border-bottom: 1px solid #d6dce5;
  background: #eef2f7;
}

.tabs button {
  min-width: 72px;
}

.tabs .is-active {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

main {
  padding: 0 22px 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #334155;
  font-weight: 650;
}

th:nth-child(1),
td:nth-child(1) {
  width: 38%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 18%;
}

th:nth-child(3),
td:nth-child(3),
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5) {
  width: 11%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 11%;
}

.name,
.path,
.meta,
.status-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name {
  font-weight: 650;
}

.path,
.meta {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.progress {
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #16a34a);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.actions button {
  max-width: 100%;
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.empty {
  padding: 34px;
  color: #64748b;
  text-align: center;
}

.status-running {
  color: #166534;
}

.status-paused {
  color: #92400e;
}

.status-failed,
.status-cancelled {
  color: #b91c1c;
}

.status-done {
  color: #1d4ed8;
}

@media (max-width: 700px) {
  header {
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }

  .manual {
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: none;
  }

  #manualUrl {
    grid-column: 1 / -1;
  }

  .tabs {
    gap: 5px;
    overflow-x: auto;
    padding: 10px 16px;
  }

  .tabs button {
    min-width: 64px;
  }

  main {
    padding: 0 12px 18px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid #d6dce5;
    border-radius: 6px;
    background: #fff;
  }

  td {
    padding: 7px 0;
    border-bottom: 1px solid #eef2f7;
  }

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

  td::before {
    display: block;
    margin-bottom: 3px;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
  }

  td:nth-child(1)::before {
    content: "파일";
  }

  td:nth-child(2)::before {
    content: "상태";
  }

  td:nth-child(3)::before {
    content: "크기";
  }

  td:nth-child(4)::before {
    content: "속도";
  }

  td:nth-child(5)::before {
    content: "남은 시간";
  }

  td:nth-child(6)::before {
    content: "작업";
  }

  td[colspan]::before {
    content: "";
    display: none;
  }

  .empty {
    padding: 24px 8px;
  }
}
