:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #1f2937;
  --muted: #687385;
  --line: #d9dee7;
  --accent: #2563eb;
  --accent-dark: #174ea6;
  --accent-soft: #eff6ff;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 650;
  min-height: 2.45rem;
  padding: 0 0.9rem;
}

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

.shell {
  margin: 0 auto;
  max-width: 1040px;
  padding: 32px 24px 48px;
}

.topbar {
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.65rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.05rem;
}

.topbar p {
  color: var(--muted);
  margin-top: 0.25rem;
}

.status-pill {
  color: var(--muted);
  font-size: 0.92rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 16px;
  padding: 16px;
}

.panel-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sort-actions {
  display: flex;
  gap: 8px;
}

.dropzone {
  align-items: center;
  background: #fbfcfe;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 92px;
  padding: 20px;
}

.dropzone.dragover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.dropzone input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.file-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-row {
  align-items: center;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 10px;
}

.file-row.dragging {
  opacity: 0.6;
}

.file-meta {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: 0;
}

.file-meta strong {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #c8dbff;
  border-radius: 6px;
  color: var(--accent-dark);
  display: inline-flex;
  height: 32px;
  justify-content: center;
  min-width: 32px;
}

.file-meta span {
  display: block;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.file-meta small {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-top: 2px;
}

.row-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.icon-button {
  align-items: center;
  display: inline-flex;
  font-size: 1.05rem;
  justify-content: center;
  min-width: 2.45rem;
  padding: 0;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.secondary,
.icon-button {
  background: white;
  color: var(--ink);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.download-row {
  align-items: flex-end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 180px;
}

.filename-field span {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.filename-field input {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 2.45rem;
  padding: 0 0.75rem;
  width: 100%;
}

.result {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

@media (max-width: 720px) {
  .shell {
    padding: 24px 16px 40px;
  }

  .topbar,
  .panel-header,
  .file-row {
    align-items: stretch;
    flex-direction: column;
  }

  .row-actions,
  .sort-actions,
  .download-row {
    grid-template-columns: 1fr;
  }

  .sort-actions {
    display: grid;
    width: 100%;
  }

  .row-actions {
    display: grid;
    width: 100%;
  }
}
