:root {
  color-scheme: light;
  --accent: #087f8c;
  --accent-dark: #045b62;
  --bg: #f6f8f7;
  --border: #d8dedb;
  --danger: #c7364a;
  --ink: #18211f;
  --muted: #66736f;
  --panel: #ffffff;
  --soft: #edf2f0;
  --sun: #f3b33d;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.top-status,
.summary {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 340px;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.file-panel,
.settings-panel,
.results-panel {
  padding: 18px;
}

.settings-panel {
  align-self: start;
}

.results-panel {
  grid-column: 1 / -1;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: end;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 750;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.primary {
  width: 100%;
  margin-top: 16px;
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button.secondary {
  width: 100%;
  margin-top: 8px;
  border-color: #f1cf8f;
  background: #fff8e8;
  color: #61410a;
}

.button.ghost {
  border-color: var(--border);
  background: #ffffff;
  color: var(--ink);
}

.button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.button.subtle {
  background: var(--soft);
  color: var(--muted);
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 178px;
  place-items: center;
  border: 1px dashed #9aaeaa;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 127, 140, 0.08), rgba(243, 179, 61, 0.1)),
    #fbfcfc;
  text-align: center;
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: #eef8f8;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.drop-copy {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.drop-copy strong {
  font-size: 20px;
}

.drop-copy span {
  color: var(--muted);
  font-size: 13px;
}

.file-list,
.results-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.empty-state {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

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

.file-main,
.result-main {
  min-width: 0;
}

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

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

.row-action {
  min-width: 86px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  min-height: 34px;
  padding: 0 10px;
}

.result-row.failed {
  border-color: #efb3bd;
  background: #fff7f8;
}

.result-row.failed .result-name {
  color: var(--danger);
}

.range-field {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.range-field > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 750;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.range-field.is-disabled {
  color: var(--muted);
  opacity: 0.64;
}

.switch-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 16px;
  font-weight: 750;
}

.switch-field input {
  position: absolute;
  opacity: 0;
}

.switch-ui {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #cad4d1;
  transition: background 160ms ease;
}

.switch-ui::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
  transition: transform 160ms ease;
}

.switch-field input:checked + .switch-ui {
  background: var(--accent);
}

.switch-field input:checked + .switch-ui::after {
  transform: translateX(20px);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-grid input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
}

.progress-shell {
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--sun);
  transition: width 180ms ease;
}

@media (max-width: 880px) {
  .app-shell {
    padding: 16px;
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: start;
    flex-direction: column;
  }

  .button-row {
    justify-content: start;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 27px;
  }

  .file-row,
  .result-row {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .button-row .button {
    flex: 1 1 110px;
  }
}
