:root {
  color-scheme: light;
  --ink: #1f171b;
  --muted: #70636a;
  --line: #e4d8dd;
  --soft: #f8f3f5;
  --brand: #c92f5b;
  --brand-dark: #3a0614;
  --accent: #d7a44d;
  --warn: #8a5a18;
  --paper: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f1edf0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.buyer-hero {
  min-height: 260px;
  padding: 42px clamp(18px, 5vw, 68px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 82% 15%, rgba(201, 47, 91, 0.28), transparent 32%),
    linear-gradient(112deg, #130006 0%, #270611 48%, #4c0c20 100%);
}

.buyer-hero span {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.buyer-hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(42px, 8vw, 76px);
  line-height: 0.95;
}

.buyer-hero p {
  max-width: 660px;
  margin: 16px 0 0;
  color: #f1dce4;
  font-size: 20px;
  line-height: 1.35;
}

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

.admin-link,
.share-link {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 900;
  text-decoration: none;
}

.share-link {
  border-color: rgba(255, 255, 255, 0.72);
  color: #2c0712;
  background: #fff;
}

.share-link.alt {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(201, 47, 91, 0.28);
}

.buyer-shell {
  width: min(1480px, calc(100% - 32px));
  margin: -36px auto 42px;
}

.buyer-note,
.buyer-toolbar,
.request-panel,
.buyer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 16px 38px rgba(24, 34, 43, 0.08);
}

.buyer-note {
  padding: 16px 18px;
  color: #5d3f12;
  border-color: #ead3a7;
  background: #fff7e8;
}

.buyer-toolbar {
  margin-top: 14px;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  align-items: end;
}

.buyer-toolbar label:first-child {
  grid-column: span 2;
}

.buyer-toolbar label,
.request-panel label {
  display: grid;
  gap: 6px;
}

.buyer-toolbar span,
.request-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.buyer-toolbar input,
.buyer-toolbar select,
.request-panel input,
.request-panel textarea {
  min-height: 44px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 750;
}

.toolbar-button {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--brand);
  background: #fff2f6;
  font-weight: 950;
}

.gallery-more {
  display: block;
  width: min(360px, 100%);
  margin: 18px auto 0;
}

.gallery-more[hidden] {
  display: none;
}

.buyer-layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

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

.gallery-head h2,
.request-panel h2 {
  margin: 0;
  font-size: 22px;
}

.gallery-head span {
  color: var(--muted);
  font-weight: 900;
}

.buyer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.buyer-card {
  min-height: 570px;
  padding: 10px;
  display: grid;
  grid-template-rows: 330px minmax(220px, 1fr);
  gap: 0;
  overflow: hidden;
}

.buyer-photo {
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #dbe3e8;
  overflow: hidden;
}

.buyer-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.buyer-card-body {
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto;
  gap: 10px;
}

.buyer-card h3 {
  margin: 0;
  font-size: 25px;
  line-height: 1.05;
}

.buyer-meta {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.buyer-age {
  color: var(--brand);
  font-size: 14px;
  font-weight: 950;
  line-height: 1.35;
}

.buyer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.buyer-tag {
  padding: 5px 8px;
  border: 1px solid #e5d8dd;
  border-radius: 999px;
  color: #4c3d43;
  background: #fbf6f8;
  font-size: 12px;
  font-weight: 900;
}

.buyer-tag.favorite {
  color: #7a4f00;
  border-color: #e8c46d;
  background: #fff6d8;
}

.buyer-tag.priority {
  color: #fff;
  border-color: #8f1740;
  background: #b91f4e;
}

.buyer-tag.outreach {
  color: #19594f;
  border-color: #99d4c9;
  background: #e7f8f4;
}

.admin-model-info {
  padding: 10px;
  border: 1px solid #ead8df;
  border-radius: 8px;
  background: #fff8fa;
  color: #4b3940;
  font-size: 12px;
  line-height: 1.35;
}

.admin-model-info-title {
  margin-bottom: 8px;
  color: var(--brand-dark);
  font-weight: 950;
}

.admin-contact-title {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.admin-contact-chip {
  max-width: 100%;
  min-height: 28px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e4c9d2;
  border-radius: 999px;
  color: var(--brand-dark);
  background: #fff;
  font-weight: 900;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.admin-info-grid {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.admin-info-grid div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 7px;
}

.admin-info-grid strong {
  color: #65717f;
}

.admin-info-grid span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-muted {
  color: #65717f;
  font-weight: 800;
}

.admin-long-info {
  margin-top: 8px;
}

.admin-long-info summary {
  color: var(--brand-dark);
  font-weight: 950;
  cursor: pointer;
}

.admin-long-info pre {
  max-height: 180px;
  margin: 8px 0 0;
  padding: 8px;
  overflow: auto;
  border-radius: 8px;
  background: #f7eef2;
  white-space: pre-wrap;
  font: inherit;
}

.buyer-thumb-strip {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.buyer-thumb {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f5eef1;
  overflow: hidden;
}

.buyer-thumb.active {
  border-color: var(--brand);
}

.buyer-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.buyer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: end;
}

.outreach-controls {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbf9fa;
}

.outreach-controls label {
  display: grid;
  gap: 6px;
}

.outreach-controls span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.outreach-controls select {
  min-height: 38px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 850;
}

.operator-cockpit {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.operator-cockpit summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.operator-cockpit summary strong {
  padding: 3px 7px;
  border-radius: 999px;
  color: #7a4f00;
  background: #fff1c7;
  font-size: 11px;
}

.operator-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 7px 9px;
  border: 1px solid #ead7df;
  border-radius: 8px;
  background: #fff;
}

.operator-score strong {
  color: var(--brand);
  font-size: 15px;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

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

.operator-grid input,
.operator-grid textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.operator-grid textarea {
  resize: vertical;
}

.operator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.operator-actions button {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
}

.operator-actions button:first-child {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.buyer-links a,
.pick-model,
.select-model,
.share-model-link {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-weight: 900;
  text-decoration: none;
}

.pick-model.selected {
  color: #7a4f00;
  border-color: #e8c46d;
  background: #fff6d8;
}

.pick-model.priority.selected {
  color: #fff;
  border-color: #8f1740;
  background: #b91f4e;
}

.favorite-button {
  width: 38px;
  min-width: 38px;
  padding: 0;
  color: #8f1740;
  font-size: 22px;
  line-height: 1;
}

.favorite-button.selected {
  color: #fff;
  border-color: #b91f4e;
  background: #b91f4e;
}

.select-model {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.select-model.selected {
  color: var(--brand);
  background: #fff2f6;
}

.share-model-link {
  color: var(--brand);
  border-color: #dfbdc8;
  background: #fff;
}

.codex-contact-link {
  color: #fff;
  border-color: #111827;
  background: #111827;
}

.request-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

body.client-mode .buyer-shell {
  margin-top: -28px;
}

body.client-mode .buyer-layout {
  grid-template-columns: minmax(0, 1fr) 380px;
}

.request-panel p {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.4;
}

.request-steps {
  margin: 0 0 16px;
  padding: 12px 14px 12px 34px;
  border: 1px solid #ead8df;
  border-radius: 8px;
  color: #4b3940;
  background: #fff6f8;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 850;
}

.request-steps li + li {
  margin-top: 6px;
}

.codex-queue-panel {
  max-width: 1400px;
  margin: 0 auto 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #d7b9c5;
  border-radius: 8px;
  background: #fff8fb;
  box-shadow: var(--shadow);
}

.codex-queue-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  color: var(--brand-dark);
}

.codex-queue-panel strong {
  font-size: 16px;
  font-weight: 950;
}

.codex-queue-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.codex-queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.codex-queue-actions button {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 950;
}

.codex-queue-actions button:last-child {
  color: var(--brand-dark);
  border-color: #ead8df;
  background: #fff;
}

.codex-queue-actions button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.codex-queue-list {
  display: none;
  gap: 8px;
  flex-basis: 100%;
}

.codex-queue-panel.is-open {
  display: grid;
  align-items: initial;
  justify-content: initial;
  padding: 14px 16px;
}

.codex-queue-panel.is-open > div:first-child {
  justify-content: space-between;
}

.codex-queue-panel.is-open .codex-queue-list {
  display: grid;
}

.codex-queue-empty {
  padding: 10px 12px;
  border: 1px dashed #d7b9c5;
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 850;
}

.codex-queue-item {
  padding: 9px 10px;
  display: grid;
  gap: 3px;
  border: 1px solid #ead8df;
  border-radius: 8px;
  background: #fff;
}

.codex-queue-item em {
  color: var(--brand-dark);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.request-panel .request-explainer {
  margin-top: -6px;
  padding: 10px 12px;
  border: 1px solid #ead8df;
  border-radius: 8px;
  color: var(--brand-dark);
  background: #fff6f8;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 850;
}

#buyer-request-form {
  display: grid;
  gap: 12px;
}

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

.request-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.request-actions button {
  min-height: 48px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 950;
}

#copy-request {
  color: var(--brand);
  background: #fff2f6;
}

#email-preview-link,
#download-purchase-order {
  color: var(--brand-dark);
  border-color: #cdd8df;
  background: #fff;
}

.empty-gallery {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 18px;
  font-weight: 800;
}

@media (max-width: 1050px) {
  .buyer-layout,
  .buyer-toolbar {
    grid-template-columns: 1fr;
  }

  .request-actions {
    grid-template-columns: 1fr;
  }

  .request-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .buyer-hero {
    min-height: 220px;
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .buyer-shell {
    width: min(100% - 20px, 1480px);
  }

  .buyer-photo {
    height: 310px;
  }
}
