:root {
  --paper: #f8f5f0;
  --panel: #fffdf9;
  --ink: #401b00;
  --muted: rgba(64, 27, 0, 0.62);
  --line: rgba(64, 27, 0, 0.14);
  --accent: #d45300;
  --accent-soft: rgba(212, 83, 0, 0.1);
  --ok: #2f6b3b;
  --warn: #9a4e00;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Sora, Arial, sans-serif;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.topbar {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  gap: 20px;
  background: rgba(248, 245, 240, 0.96);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar > div:first-child,
.top-actions {
  min-width: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  font-weight: 500;
}

h1 {
  font-size: 28px;
  line-height: 1;
}

.top-actions,
.bottom-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.view-switch {
  border: 1px solid var(--line);
  display: inline-flex;
  min-height: 40px;
}

.view-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  min-height: 38px;
  padding: 0 13px;
}

.view-button + .view-button,
.view-button + .view-icon-button {
  border-left: 1px solid var(--line);
}

.view-button.active {
  background: var(--accent);
  color: #fff;
}

.view-icon-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 38px;
  padding: 0;
  width: 42px;
}

.view-icon-button:hover,
.view-icon-button:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.view-icon-button.unlocked {
  color: var(--ok);
}

.view-icon-button svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button.ghost {
  background: transparent;
  color: var(--accent);
}

.button.small {
  min-height: 32px;
  font-size: 12px;
}

.button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.62;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.text-button:disabled,
a.disabled {
  color: var(--muted);
  cursor: not-allowed;
  pointer-events: none;
}

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

.app-shell.grid-mode {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.app-shell.grid-mode .review {
  display: none;
}

.queue {
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.44);
  min-height: calc(100vh - 76px);
  position: sticky;
  top: 76px;
  align-self: start;
  height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.queue-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.queue-header > div {
  min-width: 0;
}

.count {
  font-size: 14px;
  font-weight: 700;
}

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

.search {
  margin: 12px;
  width: calc(100% - 24px);
}

.status-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 12px 12px;
}

.status-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: 6px;
  text-align: center;
  font-size: 11px;
}

.status-chip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-chip.active {
  border-color: rgba(212, 83, 0, 0.5);
  background: var(--accent-soft);
  color: var(--accent);
}

.status-chip.active span {
  color: var(--accent);
}

.queue-list {
  overflow: auto;
  padding: 0 8px 12px;
}

.queue-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  width: 100%;
  text-align: left;
  padding: 10px 9px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.queue-item:hover,
.queue-item.active {
  border-color: var(--line);
  background: var(--panel);
}

.queue-item-title {
  font-size: 13px;
  line-height: 1.25;
}

.queue-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.status-pill {
  border: 1px solid var(--line);
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 10px;
  padding: 3px 6px;
}

.status-pill.available {
  border-color: rgba(47, 107, 59, 0.22);
  color: var(--ok);
}

.status-pill.sold {
  border-color: rgba(154, 78, 0, 0.24);
  color: var(--warn);
}

.review {
  display: grid;
  grid-template-columns: minmax(360px, 0.94fr) minmax(430px, 1.06fr);
  gap: 28px;
  padding: 24px;
  align-items: start;
  min-width: 0;
}

.image-panel {
  position: sticky;
  top: 100px;
  min-width: 0;
}

.image-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  min-height: 560px;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-wrap img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 190px);
  object-fit: contain;
}

.image-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

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

.image-meta a {
  color: var(--accent);
}

.editor {
  background: rgba(255, 253, 249, 0.68);
  border: 1px solid var(--line);
  padding: 20px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.editor-head > div:first-child {
  min-width: 0;
}

.editor-head-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.icon-button {
  align-items: center;
  background: rgba(255, 253, 249, 0.88);
  border: 1px solid var(--line);
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  padding: 0;
  width: 42px;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(212, 83, 0, 0.48);
  background: var(--accent-soft);
  outline: none;
}

.icon-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.52;
}

.icon-button.copied {
  border-color: rgba(47, 107, 59, 0.42);
  color: var(--ok);
}

.icon-button svg {
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 21px;
}

.position {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

h2 {
  font-size: 36px;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

h3 {
  font-size: 22px;
  margin-bottom: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

label.wide {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.82);
  color: var(--ink);
  padding: 10px 11px;
  min-height: 40px;
  outline: none;
  min-width: 0;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(212, 83, 0, 0.58);
}

input[readonly],
textarea[readonly] {
  color: var(--muted);
  background: rgba(64, 27, 0, 0.04);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: rgba(64, 27, 0, 0.46);
  background: rgba(64, 27, 0, 0.06);
  cursor: not-allowed;
}

label.not-applicable::after {
  content: "Not applicable for paintings";
  color: var(--muted);
  font-size: 11px;
}

.field-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.group {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.bottom-actions {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  justify-content: flex-end;
}

.grid-view {
  padding: 22px;
  min-width: 0;
}

.grid-head {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.grid-head h2 {
  font-size: 32px;
}

.grid-note {
  color: var(--muted);
  font-size: 12px;
}

.grid-scroll {
  border: 1px solid var(--line);
  max-height: calc(100vh - 170px);
  overflow: auto;
  background: var(--panel);
  max-width: 100%;
}

.data-grid {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.data-grid th,
.data-grid td {
  border-bottom: 1px solid rgba(64, 27, 0, 0.1);
  border-right: 1px solid rgba(64, 27, 0, 0.08);
  padding: 6px;
  vertical-align: top;
}

.data-grid th {
  background: #f1ebe2;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  position: sticky;
  text-align: left;
  top: 0;
  z-index: 2;
}

.data-grid td {
  background: var(--panel);
}

.data-grid tbody tr {
  min-height: 74px;
}

.data-grid tr.sold-row td {
  background: #f4ece3;
}

.data-grid tr.unsaved-row td {
  box-shadow: inset 0 2px 0 rgba(212, 83, 0, 0.34);
}

.data-grid tr.saved-row td {
  box-shadow: inset 0 2px 0 rgba(47, 107, 59, 0.25);
}

.data-grid .sticky-col {
  left: 0;
  position: sticky;
  background: var(--panel);
  box-shadow: 1px 0 0 rgba(64, 27, 0, 0.12);
  z-index: 1;
}

.data-grid .grid-title-col {
  left: 116px;
}

.data-grid th.sticky-col {
  background: #f1ebe2;
  z-index: 3;
}

.data-grid tr.sold-row .sticky-col {
  background: #f4ece3;
}

.grid-thumb-col {
  min-width: 116px;
}

.grid-thumb {
  background: rgba(64, 27, 0, 0.04);
  border: 1px solid rgba(64, 27, 0, 0.1);
  display: block;
  height: 82px;
  object-fit: contain;
  width: 96px;
}

.grid-thumb.missing {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  justify-content: center;
  text-align: center;
}

.grid-title-cell {
  display: grid;
  gap: 4px;
  min-width: 250px;
}

.grid-title-main {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.grid-title-sub {
  color: var(--muted);
  font-size: 10px;
}

.grid-open {
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  justify-self: start;
  text-decoration: underline;
}

.grid-input,
.grid-select,
.grid-textarea {
  background: rgba(255, 253, 249, 0.74);
  border: 1px solid transparent;
  color: var(--ink);
  font-size: 12px;
  min-height: 34px;
  padding: 7px 8px;
  width: 100%;
}

.grid-input:focus,
.grid-select:focus,
.grid-textarea:focus {
  background: #fff;
  border-color: rgba(212, 83, 0, 0.52);
}

.grid-input[readonly],
.grid-input:disabled,
.grid-select:disabled,
.grid-textarea:disabled {
  background: rgba(64, 27, 0, 0.04);
  color: var(--muted);
  cursor: not-allowed;
}

.grid-textarea {
  line-height: 1.45;
  min-height: 118px;
  resize: vertical;
  white-space: pre-wrap;
}

.portfolio-page {
  background: var(--paper);
}

.portfolio-topbar {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(20px, 4vw, 44px);
}

.portfolio-topbar h1 {
  font-size: clamp(40px, 6vw, 76px);
  line-height: 0.95;
}

.portfolio-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.portfolio-shell {
  display: grid;
  gap: 28px;
  padding: clamp(18px, 4vw, 44px);
}

.portfolio-controls {
  display: grid;
  gap: 14px;
}

.portfolio-search {
  background: var(--panel);
  font-size: 18px;
  min-height: 54px;
  padding-inline: 16px;
}

.portfolio-filter-row {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(280px, 1.1fr) repeat(3, minmax(150px, 0.7fr));
}

.portfolio-status {
  padding: 0;
}

.portfolio-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.portfolio-card {
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
  min-width: 0;
  position: relative;
}

.portfolio-card-link {
  display: block;
  inset: 0;
  position: absolute;
  z-index: 1;
}

.portfolio-card-link:focus-visible {
  outline: 2px solid rgba(212, 83, 0, 0.18);
  outline-offset: 3px;
}

.portfolio-card.sold {
  background: rgba(255, 253, 249, 0.72);
}

.portfolio-card-main {
  color: inherit;
  display: grid;
  grid-template-rows: 270px 1fr;
  height: 100%;
  min-width: 0;
}

.portfolio-card-image {
  align-items: center;
  background: rgba(64, 27, 0, 0.04);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 12px;
}

.portfolio-card-image img {
  display: block;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  transition: transform 180ms ease;
}

.portfolio-card:hover .portfolio-card-image img,
.portfolio-card:has(.portfolio-card-link:focus-visible) .portfolio-card-image img {
  transform: scale(1.015);
}

.portfolio-card.missing-image .portfolio-card-image::before {
  color: var(--muted);
  content: "Image pending";
  font-size: 12px;
}

.portfolio-card.missing-image .portfolio-card-image img {
  display: none;
}

.portfolio-card-copy {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.portfolio-card-meta {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.portfolio-status-actions {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.portfolio-collection {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-card h2 {
  font-size: 25px;
  line-height: 1;
}

.portfolio-card:hover h2,
.portfolio-card:has(.portfolio-card-link:focus-visible) h2 {
  color: var(--accent);
}

.portfolio-card h2 {
  color: var(--ink);
}

.portfolio-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.portfolio-details {
  display: grid;
  gap: 7px;
  margin: 0;
}

.portfolio-details div {
  display: grid;
  gap: 8px;
  grid-template-columns: 72px minmax(0, 1fr);
}

.portfolio-details dt {
  color: var(--muted);
  font-size: 11px;
}

.portfolio-details dd {
  font-size: 12px;
  margin: 0;
  min-width: 0;
}

.portfolio-copy {
  align-items: center;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  height: 25px;
  justify-content: center;
  padding: 0;
  position: relative;
  width: 25px;
  z-index: 2;
}

.portfolio-copy svg {
  fill: none;
  height: 14px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 14px;
}

.portfolio-copy:hover,
.portfolio-copy:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.portfolio-copy.copied {
  border-color: rgba(47, 107, 59, 0.42);
  color: var(--ok);
}

.portfolio-empty {
  border: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  min-height: 220px;
  place-items: center;
}

.portfolio-empty h2 {
  font-size: 30px;
}

.share-page {
  background: var(--panel);
}

.share-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

.share-artwork {
  min-height: 100vh;
  background: var(--paper);
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 56px);
}

.share-artwork img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 72px);
  object-fit: contain;
}

.share-copy {
  align-content: center;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 18px;
  min-height: 100vh;
  padding: clamp(26px, 5vw, 64px);
}

.share-copy h1 {
  font-size: clamp(40px, 5vw, 72px);
  line-height: 0.95;
}

.share-copy h2 {
  font-family: Inter, Sora, Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.share-status {
  border: 1px solid rgba(47, 107, 59, 0.24);
  color: var(--ok);
  display: inline-flex;
  justify-self: start;
  padding: 7px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.share-summary {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.35;
  margin: 0;
}

.share-description,
.share-care {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.share-description {
  hyphens: auto;
  text-align: justify;
  text-justify: inter-word;
}

.share-description p,
.share-care p {
  margin: 0;
}

.share-details {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.share-details dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.share-details dl div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(64, 27, 0, 0.08);
}

.share-details dt {
  color: var(--muted);
  font-size: 12px;
}

.share-details dd {
  margin: 0;
  font-size: 14px;
}

.share-care {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.share-error {
  display: grid;
  gap: 12px;
  margin: auto;
  max-width: 560px;
  padding: 32px;
}

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

  .queue {
    position: static;
    height: auto;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .queue-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(210px, 260px);
    overflow-x: auto;
    overflow-y: hidden;
  }

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

  .grid-view {
    padding: 14px;
  }

  .grid-scroll {
    max-height: 72vh;
  }

  .image-panel {
    position: static;
  }

  .image-wrap {
    min-height: 320px;
  }

  .portfolio-filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .share-shell {
    grid-template-columns: 1fr;
  }

  .share-artwork {
    min-height: 58vh;
  }

  .share-copy {
    border-left: 0;
    border-top: 1px solid var(--line);
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    padding: 14px;
    position: static;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button {
    flex: 1 1 136px;
  }

  .view-switch {
    flex: 1 1 100%;
  }

  .view-button {
    flex: 1 1 auto;
  }

  .queue {
    top: 0;
  }

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

  .queue-header .button {
    width: 100%;
  }

  .review {
    padding: 14px;
  }

  .editor {
    padding: 14px;
  }

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

  .editor-head-actions {
    align-self: flex-end;
  }

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

  h2 {
    font-size: 30px;
  }

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

  .image-actions {
    justify-content: flex-start;
  }

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

  .portfolio-count {
    text-align: left;
  }

  .portfolio-filter-row {
    grid-template-columns: 1fr;
  }

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

  .portfolio-card-main {
    grid-template-rows: 240px 1fr;
  }

  .portfolio-details div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .share-copy h1 {
    font-size: 38px;
  }

  .share-copy h2 {
    font-size: 12px;
  }

  .share-details dl div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

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