:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f9fbfb;
  --text: #1d2528;
  --muted: #6f7b80;
  --border: #dce4e5;
  --teal: #11897d;
  --teal-dark: #0a5f58;
  --amber: #c78312;
  --danger: #b93b3b;
  --shadow: 0 18px 44px rgba(36, 51, 56, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  background: #11191b;
  color: #f7fbfb;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  font-weight: 800;
  font-size: 15px;
}

.side-rail nav {
  display: grid;
  gap: 10px;
}

.rail-item {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: #ced8da;
  cursor: pointer;
}

.rail-item.active {
  background: #233133;
  color: white;
}

.rail-status {
  margin-top: auto;
  width: 42px;
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #223033;
  color: #a7e9dd;
  font-size: 11px;
  font-weight: 700;
}

.rail-status.bad {
  color: #ffd0d0;
}

.workspace {
  padding: 28px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.topbar,
.work-panel,
.settings-panel,
.log-strip {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 96px;
  border-radius: 8px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.15;
  font-weight: 780;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 760;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  min-height: 38px;
  border-radius: 8px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 720;
  color: var(--text);
}

.btn.primary {
  background: var(--teal);
  color: white;
}

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

.btn.secondary {
  border-color: var(--border);
  background: #f7faf9;
}

.btn.download {
  background: #171f22;
  color: white;
}

.btn.disabled,
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
}

.work-panel,
.settings-panel {
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

.dropzone {
  min-height: 132px;
  border: 1px dashed #a9c6c4;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfefe, #f4faf9);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  cursor: pointer;
}

.dropzone.drag {
  border-color: var(--teal);
  background: #eefaf8;
}

.dropzone input {
  display: none;
}

.drop-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e5f4f1;
  color: var(--teal-dark);
  font-size: 26px;
  font-weight: 600;
}

.dropzone strong {
  display: block;
  font-size: 18px;
}

.dropzone span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.queue-head {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#queueMeta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.queue-table {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 118px;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-top: 1px solid var(--border);
  background: white;
}

.queue-row:first-child {
  border-top: 0;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 690;
}

.file-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #e7eeee;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--teal);
}

.status-pill {
  justify-self: end;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f3;
  color: #415055;
  font-size: 12px;
  font-weight: 740;
}

.status-pill.processing {
  background: #fff5dc;
  color: #8a5b06;
}

.status-pill.complete {
  background: #e6f6f2;
  color: #0b6d63;
}

.status-pill.failed {
  background: #fde9e9;
  color: var(--danger);
}

.empty-state {
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toggle-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.toggle-row:first-of-type {
  border-top: 0;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  margin-top: 2px;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  color: var(--muted);
  margin-top: 3px;
}

.field-row {
  display: grid;
  gap: 6px;
}

.field-row span {
  color: #3e4a4e;
  font-size: 13px;
  font-weight: 700;
}

.field-row input,
.field-row select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px 10px;
}

.summary-strip {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-strip div {
  border-radius: 8px;
  padding: 10px;
  background: #f6f9f9;
  border: 1px solid var(--border);
}

.summary-strip strong {
  display: block;
  font-size: 17px;
}

.summary-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.log-strip {
  border-radius: 8px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 14px;
  min-height: 76px;
}

.log-title {
  font-size: 13px;
  font-weight: 780;
}

.log-list {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: static;
    height: auto;
    min-height: 62px;
    flex-direction: row;
    justify-content: space-between;
  }

  .side-rail nav {
    display: flex;
  }

  .rail-status {
    margin-top: 0;
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .btn {
    flex: 1 1 auto;
  }

  .main-grid {
    display: grid;
  }

  .dropzone,
  .queue-row,
  .log-strip {
    grid-template-columns: 1fr;
  }

  .status-pill {
    justify-self: start;
  }
}
