:root {
  color-scheme: light;
  --bg: #f1eadf;
  --panel: #fffaf2;
  --panel-2: #f8f1e6;
  --ink: #171613;
  --muted: #665f55;
  --line: #d8cdbc;
  --accent: #9c4a2c;
  --accent-2: #d08b37;
  --shadow: 0 18px 50px rgb(46 31 13 / 0.08);
}

* {
  box-sizing: border-box;
}

.is-hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  background:
    radial-gradient(circle at top, rgb(255 255 255 / 0.82), transparent 38%),
    linear-gradient(180deg, #eadfcf 0%, var(--bg) 100%);
  color: var(--ink);
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  font-weight: 600;
}

.lede {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.6;
}

.controls,
.panel,
.status {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 16px;
}

.results-column {
  min-width: 0;
}

.controls {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.picker,
.threshold-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.inline-check input {
  width: 16px;
  height: 16px;
}

.upload-stack,
.action-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-stack {
  min-width: 0;
}

.upload-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.drop-zone {
  min-height: 160px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.72), rgb(255 251 244 / 0.96)),
    radial-gradient(circle at top, rgb(208 139 55 / 0.14), transparent 58%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: default;
  transition: border-color 120ms ease, transform 120ms ease, background-color 120ms ease;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  transform: translateY(-1px) scale(1.005);
}

.drop-zone.disabled {
  opacity: 0.6;
  cursor: progress;
}

.drop-zone-inner {
  text-align: center;
}

.drop-title {
  margin: 0 0 8px;
  font-size: 22px;
}

.drop-copy,
.queue-summary,
.status-detail {
  color: var(--muted);
}

.picker-inline {
  min-width: auto;
}

.picker input,
.threshold-control input,
button {
  font: inherit;
}

button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 13px 18px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgb(156 74 44 / 0.18);
}

.button-secondary {
  background: #fffdf8;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

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

.status {
  padding: 16px 18px;
  color: var(--muted);
}

.run-panel {
  display: grid;
  gap: 12px;
}

.results-panel > .run-panel {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.run-panel-embedded {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

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

.run-meta {
  color: var(--muted);
  font-size: 13px;
}

.run-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.run-inline {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(110px, 1fr));
  gap: 12px;
}

.run-inline-block {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf9, #f8f1e7);
  min-width: 0;
}

.run-inline-wide {
  min-width: 0;
}

.run-inline-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.run-inline-value {
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}

.run-phase-line {
  font-size: 13px;
  color: var(--muted);
}

.progress-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.progress-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fffdf9, #f8f1e7);
}

.progress-card-wide {
  grid-column: span 2;
}

.progress-card-label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-card-value {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.4;
}

.progress-card-file {
  word-break: break-word;
}

.queue-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.queue-list-embedded {
  max-height: 520px;
}

.queue-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf9, #f8f1e8);
}

.queue-row-active {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fff9f1, #ffefde);
  box-shadow: 0 0 0 2px rgb(156 74 44 / 0.08);
}

.queue-row-done {
  background: linear-gradient(180deg, #fbfaf7, #f3eee6);
}

.queue-row-skip {
  background: linear-gradient(180deg, #fff6f2, #ffebe2);
}

.queue-state {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.queue-name {
  font-size: 13px;
  color: var(--ink);
  word-break: break-word;
}

.status-line {
  color: var(--ink);
  margin-bottom: 10px;
}

.progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e6dfd1;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 120ms ease;
}

.panel {
  padding: 18px;
}

.log {
  max-height: 240px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-row {
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7f0e4;
  font-size: 13px;
  color: var(--ink);
}

.log-warn {
  background: #fff3df;
}

.log-error {
  background: #ffe3de;
}

.group-card-provisional {
  opacity: 0.92;
}

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

.group-meta {
  color: var(--muted);
  font-size: 12px;
}

.group-summary {
  display: grid;
  gap: 6px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.group-summary-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ready-state {
  display: grid;
  gap: 16px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgb(255 253 249 / 0.98), rgb(248 241 231 / 0.98)),
    radial-gradient(circle at top right, rgb(208 139 55 / 0.12), transparent 42%);
}

.ready-state-head {
  display: grid;
  gap: 8px;
}

.ready-state-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.ready-state-note,
.ready-state-threshold {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ready-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ready-step {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf9, #f8f1e8);
}

.ready-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.ready-step-copy {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.queued-summary {
  padding-top: 6px;
}

.group-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.group-toggle {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-top: 14px;
  background: linear-gradient(180deg, #fffdf9, #fbf5ec);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.group-toggle:first-child {
  margin-top: 0;
  padding-top: 16px;
}

.group-toggle > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 12px;
}

.group-toggle > summary::-webkit-details-marker {
  display: none;
}

.group-toggle:hover {
  border-color: #cbb598;
  transform: translateY(-1px);
}

.group-toggle[open] .group-meta {
  color: var(--accent);
}

.group-toggle[open] {
  border-color: #ccb79c;
  box-shadow: 0 16px 32px rgb(46 31 13 / 0.08);
}

.group-body {
  padding-top: 12px;
}

.group-thumb {
  margin: 0;
}

.group-strip-compact {
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
}

.group-thumb-compact {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.group-thumb-mini {
  width: 48px;
  height: 48px;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ede2cf;
}

.group-thumb img {
  display: block;
  width: 100%;
  height: 132px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.group-thumb figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.group-names {
  display: grid;
  gap: 6px;
  padding-top: 4px;
}

.group-name {
  font-size: 13px;
  color: var(--ink);
}

.panel-summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}

.panel-summary::-webkit-details-marker {
  display: none;
}

.results-panel {
  min-height: 100%;
}

.singles-card {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}

.single-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.single-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: #f5f0e4;
  border: 1px solid var(--line);
  color: var(--ink);
  min-width: 0;
}

.single-card-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  background: #ede2cf;
}

.single-card-name {
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.single-card-more {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  background: #faf6ee;
}

@media (max-width: 720px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .controls {
    align-items: stretch;
  }

  .upload-stack,
  .threshold-control,
  .action-stack {
    width: 100%;
  }

  .progress-card-wide {
    grid-column: span 1;
  }

  .run-inline {
    grid-template-columns: 1fr;
  }

  .ready-steps {
    grid-template-columns: 1fr;
  }

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