.controls-panel {
  position: sticky;
  top: 16px;
}

#batch-status:empty { min-height:0; margin:0; }

.settings-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-heading h2 {
  margin: 0;
  white-space: nowrap;
}

.settings-heading button { flex-shrink:0; white-space:nowrap; }

.file-field {
  margin-bottom: 14px;
}

.file-drop-zone {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 16px;
  min-height: 108px;
  padding: 16px;
  border: 1px dashed var(--control-line);
  border-radius: 12px;
  background: var(--paper);
}

.file-drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.file-drop-zone { background:#fafafd; }
.drop-copy::before { content:""; width:32px; height:32px; margin:0 auto 4px; background:var(--accent); mask:url('/assets/icons/upload.svg') center/contain no-repeat; }
.choice-list label { padding:12px; border:1px solid var(--line); border-radius:10px; }
.choice-list label:has(input:checked) { border-color:var(--accent); background:var(--accent-soft); }

.drop-copy {
  text-align: center;
  display: grid;
  gap: 4px;
}

.drop-copy strong {
  font-size: 1rem;
}

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

.file-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.quick-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.quick-settings .quick-setting {
  min-height: 44px;
  padding: 8px 9px;
  font-size: .76rem;
}

.quick-settings .quick-setting[aria-pressed=true] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.selection-summary {
  margin: 0;
  color: var(--ink);
  font-size: .85rem;
  overflow-wrap: anywhere;
}

.choice-list {
  display: grid;
  gap: 8px;
}

.choice-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 36px;
  font-size: .9rem;
}

.choice-list input {
  flex: none;
  margin-top: 3px;
}

.choice-copy {
  display: grid;
  gap: 2px;
}

.choice-copy small {
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}

.size-help {
  margin: -10px 0 16px;
}

.local-note {
  margin: 20px 0 10px;
  padding: 12px 14px;
  border: 1px solid #cde6d5;
  border-radius: 10px;
  background: var(--positive-soft);
  font-size: .85rem;
}

.results-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.results-heading h2 {
  margin-bottom: 16px;
}

.results-summary {
  margin-bottom: 8px;
  padding: 10px 12px;
  background: var(--paper);
  border-radius: 12px;
  color: var(--muted);
  font-size: .85rem;
}

.result-list {
  display: grid;
}

.result-card {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.result-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.result-card:first-child {
  padding-top: 12px;
}

.result-preview {
  display: grid;
  place-items: center;
  width: 144px;
  aspect-ratio: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
}

button.result-preview {
  cursor: zoom-in;
}

button.result-preview:hover {
  background: #f0f0f6;
  border-color: var(--control-line);
}

.result-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-copy {
  min-width: 0;
}

.result-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-name {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  font-size: 1rem;
}

.result-badge {
  flex: none;
  white-space: nowrap;
}

.result-badge.fail {
  color: var(--danger);
  background: #f8e5e2;
}

.result-badge.error-state {
  color: #704415;
  background: #f7ebd8;
}

.result-message {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: .88rem;
}

.result-message.fail {
  color: var(--danger);
}

.result-measure {
  margin-bottom: 10px;
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.5;
}

.result-details {
  margin-bottom: 12px;
  padding: 10px 0 0;
}

.result-details summary {
  font-size: .82rem;
}

.result-details p {
  font-size: .8rem;
  line-height: 1.55;
}

.result-actions {
  margin: 0;
}

.error-placeholder {
  color: var(--danger);
  font-size: 1.6rem;
  font-weight: 700;
}

.preview-dialog {
  width: min(960px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
}

.preview-dialog::backdrop {
  background: rgba(30, 30, 38, .72);
}

.preview-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.preview-dialog-heading h2 {
  margin: 0;
}

.preview-dialog figure {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 0;
}

.preview-dialog img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  background: var(--paper);
}

.preview-dialog figcaption {
  color: var(--muted);
  font-size: .85rem;
  overflow-wrap: anywhere;
}

@media (max-width: 800px) {
  .controls-panel {
    position: static;
  }

  .settings-heading {
    position: sticky;
    flex-wrap: wrap;
    z-index: 2;
    top: 8px;
    padding: 8px 0;
    background: var(--surface);
    box-shadow: 0 8px 8px var(--surface);
  }
}

@media (max-width: 520px) {
  .results-heading,
  .result-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .results-heading .button,
  .results-heading button {
    width: 100%;
  }

  .result-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .file-drop-zone {
    min-height: 0;
  }

  .result-preview {
    width: min(180px, 100%);
  }

  .result-badge {
    align-self: flex-start;
  }

  .preview-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 14px;
  }
}
