:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #637083;
  --line: #d9e0ea;
  --brand: #1264d8;
  --brand-dark: #0b4cab;
  --danger: #b42318;
  --ok: #087443;
  --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
textarea,
.dropzone {
  min-height: 44px;
}

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px 14px 40px;
}

.topbar,
.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.mode-tab {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.mode-tab.is-active {
  background: var(--brand);
  color: #fff;
}

.panel,
.progress-panel,
.results-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  padding: 28px 16px;
  border: 2px dashed #9bb7dc;
  border-radius: 8px;
  background: #f8fbff;
  cursor: pointer;
  text-align: center;
}

.dropzone.is-dragover {
  border-color: var(--brand);
  background: #eef6ff;
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-title {
  font-size: 20px;
  font-weight: 800;
}

.drop-subtitle,
.hint,
.notice,
.file-summary span,
.job-id {
  color: var(--muted);
}

.file-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 10px;
  flex-wrap: wrap;
}

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

.file-item,
.job-file,
.download-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--brand);
  font-weight: 800;
}

.file-name,
.job-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.file-size,
.job-file-status {
  color: var(--muted);
  font-size: 13px;
}

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

.icon-button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.icon-button.danger {
  color: var(--danger);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label {
  font-weight: 800;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.text-input-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.text-input-block label {
  font-weight: 800;
}

.primary,
.ghost {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 800;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.62;
}

.ghost {
  width: auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.notice,
.hint {
  margin: 12px 0 0;
  line-height: 1.45;
}

.progress-panel,
.results-panel {
  margin-top: 16px;
  padding: 18px;
}

.progress-bar {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf6;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.25s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  flex-wrap: wrap;
}

.status-message {
  margin: 14px 0;
  font-weight: 700;
}

.job-files,
.download-links {
  display: grid;
  gap: 10px;
}

.download-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.download-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #eaf2ff;
  color: var(--brand);
  font-weight: 800;
  text-decoration: none;
}

.status-done {
  color: var(--ok);
}

.status-error,
.status-partial_error {
  color: var(--danger);
}

@media (max-width: 760px) {
  .shell {
    padding-inline: 10px;
  }

  .topbar,
  .progress-head,
  .workspace {
    display: grid;
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .panel,
  .progress-panel,
  .results-panel {
    padding: 14px;
  }

  .dropzone {
    padding: 24px 12px;
  }

  .file-item,
  .job-file {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .file-actions {
    grid-column: 1 / -1;
  }

  .file-actions .icon-button {
    flex: 1;
  }

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

  .download-row a {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .shell {
    padding-inline: 8px;
  }

  .drop-title {
    font-size: 18px;
  }

  .file-summary,
  .progress-meta {
    display: grid;
  }
}
