:root {
  --ink: #1e2528;
  --muted: #647174;
  --line: #d8dedc;
  --panel: #ffffff;
  --field: #f6f8f7;
  --accent: #b7372f;
  --accent-dark: #7f241f;
  --green: #2f6f4e;
  --gold: #c99a2e;
  --page: #eef1ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(183, 55, 47, 0.08), transparent 35%),
    linear-gradient(180deg, #f8faf8 0%, #e9eeeb 100%);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

select {
  min-height: 2.45rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  padding: 0 12px;
}

button {
  min-height: 2.35rem;
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: var(--accent-dark);
}

.suite-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.suite-shell.wide {
  width: min(1480px, calc(100% - 28px));
}

.suite-header {
  padding: 24px 0 18px;
}

.suite-header.compact {
  padding-bottom: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
}

.tool-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.tool-tile,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(28, 34, 33, 0.08);
}

.tool-tile {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  text-decoration: none;
}

.tool-tile.active {
  border-color: rgba(183, 55, 47, 0.45);
}

.tool-tile.disabled {
  color: var(--muted);
  background: #f3f5f4;
}

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

.resolve-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.inline-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.naming-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.naming-fields label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.naming-fields small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

input {
  min-height: 2.45rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  padding: 0 12px;
}

.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  width: fit-content;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}

.checkbox-row input {
  width: auto;
  min-height: 0;
}

.error {
  margin: 14px 0 0;
  color: var(--accent-dark);
  font-weight: 700;
}

.generation-status {
  min-height: 1.4rem;
  margin: 10px 0 0;
  color: var(--muted);
}

.metadata-grid,
.summary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}

.metadata-grid div,
.summary-list div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  padding: 10px;
}

.metadata-grid .wide-field {
  grid-column: 1 / -1;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.browser-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.plain-list,
.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plain-list li,
.source-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.source-list a {
  text-decoration: none;
}

.source-checkbox {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  cursor: pointer;
}

.source-checkbox input {
  width: auto;
  min-height: 0;
  margin-right: 6px;
}

.source-picker button {
  margin-top: 10px;
}

.selected-source {
  color: var(--accent-dark);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.workflow-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-button {
  border-color: var(--line);
  color: var(--ink);
  background: var(--field);
}

.secondary-button.active,
.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--accent-dark);
  color: #fff;
  background: var(--accent);
}

.json-result {
  min-height: 8rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  padding: 12px;
  overflow-wrap: anywhere;
}

.result-message {
  white-space: pre-wrap;
}

.readable-result {
  display: grid;
  gap: 12px;
}

.readable-title {
  margin-bottom: 0;
}

.status-pill {
  width: fit-content;
  margin: 0;
  border-radius: 999px;
  padding: 7px 10px;
  color: #fff;
  background: var(--muted);
  font-weight: 700;
}

.status-pill.approval_required,
.status-pill.success,
.status-pill.verified {
  background: var(--green);
}

.status-pill.blocked,
.status-pill.discrepancies_found,
.status-pill.not_found,
.status-pill.selection_required {
  background: var(--accent);
}

.readable-section {
  min-width: 0;
}

.readable-section h3 {
  margin-bottom: 8px;
}

.readable-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin: 0;
}

.readable-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 9px;
}

.readable-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

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

.candidate-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.candidate-card button {
  justify-self: start;
}

.muted-line {
  margin-bottom: 0;
  color: var(--muted);
}

.raw-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.raw-json {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  white-space: pre-wrap;
}

.terminal-window {
  min-height: 12rem;
  max-height: 24rem;
  overflow: auto;
  border: 1px solid #182022;
  border-radius: 6px;
  background: #101719;
  color: #d8f0dc;
  padding: 12px;
  white-space: pre-wrap;
}

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

.status-step {
  border-left: 4px solid var(--muted);
  border-radius: 6px;
  background: var(--field);
  padding: 9px 12px;
}

.status-step.complete {
  border-left-color: var(--green);
}

.status-step.running {
  border-left-color: var(--gold);
}

.status-step.blocked,
.status-step.error {
  border-left-color: var(--accent);
}

.approval-actions {
  margin-top: 12px;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}

.section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.section-bar p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.photo-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.photo-card.sortable-ghost {
  opacity: 0.45;
}

.photo-link {
  display: block;
  aspect-ratio: 4 / 3;
  background: #dfe5e2;
}

.photo-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 10px;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sequence,
.page-label {
  display: inline-flex;
  min-width: 2rem;
  min-height: 1.6rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 8px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.page-label {
  background: var(--gold);
}

.photo-card h3 {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.caption-field {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.filename-preview {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.caption-input {
  min-height: 2.15rem;
  margin-bottom: 10px;
  padding: 0 8px;
  font-size: 0.88rem;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.card-actions button {
  min-height: 2rem;
  padding: 0 6px;
  font-size: 0.84rem;
}

.excluded-grid .photo-card {
  opacity: 0.88;
}

.page-groups {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.page-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
  padding: 10px;
}

.page-group strong {
  display: block;
  margin-bottom: 6px;
}

.page-group ol {
  margin: 0;
  padding-left: 22px;
}

@media (max-width: 860px) {
  .naming-fields {
    grid-template-columns: 1fr;
  }

  .inline-form-row,
  .browser-columns,
  .review-layout {
    grid-template-columns: 1fr;
  }
}
