:root {
  --page-bg: #f7efe3;
  --surface-bg: #fffaf2;
  --text-primary: #2d241d;
  --text-secondary: #6f6256;
  --border-color: #e3d5c4;
  --accent-primary: #b85c45;
  --accent-primary-hover: #964533;
  --accent-secondary: #4d7772;
  --danger-color: #b42318;
  --success-color: #067647;
  --radius: 16px;
  --content-width: 1080px;
  --shadow: 0 18px 45px rgba(80, 55, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at top left, #fff8eb 0, var(--page-bg) 34rem);
  color: var(--text-primary);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  margin: 0;
  overflow-x: hidden;
}

a {
  color: var(--accent-primary-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(77, 119, 114, 0.45);
  outline-offset: 3px;
}

main,
.site-header,
.site-footer,
.flash-messages {
  margin-inline: auto;
  max-width: var(--content-width);
  padding-inline: clamp(1rem, 4vw, 2rem);
}

main {
  padding-block: clamp(2rem, 6vw, 4.5rem);
}

.site-header {
  align-items: center;
  display: flex;
  min-height: 4.5rem;
}

.site-name {
  color: var(--text-primary);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 2rem;
  padding-block: 1.5rem 2rem;
}

.flash-messages {
  display: grid;
  gap: 0.75rem;
}

.flash,
[aria-labelledby="errors-heading"] {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: calc(var(--radius) - 6px);
  box-shadow: var(--shadow);
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
}

.flash-notice {
  border-color: rgba(6, 118, 71, 0.35);
  color: var(--success-color);
}

.flash-alert,
[aria-labelledby="errors-heading"] {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--danger-color);
}

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

h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  letter-spacing: -0.07em;
  line-height: 0.95;
  max-width: 11ch;
}

h2 {
  font-size: clamp(1.65rem, 4vw, 2.5rem);
  letter-spacing: -0.04em;
}

.lede {
  color: var(--text-secondary);
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  max-width: 35rem;
}

.button,
button,
input[type="submit"] {
  align-items: center;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 750;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.8rem 1.15rem;
  text-decoration: none;
  touch-action: manipulation;
}

.button-primary,
input[type="submit"] {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fffaf2;
}

.button-small {
  min-height: 2.5rem;
  padding: 0.55rem 0.9rem;
}

.button-danger {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
}

.button:hover,
button:hover,
input[type="submit"]:hover {
  border-color: var(--accent-primary-hover);
}

.button-primary:hover,
input[type="submit"]:hover {
  background: var(--accent-primary-hover);
  color: #fffaf2;
}

form {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 4vw, 2rem);
}

.button_to {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

label {
  display: block;
  color: var(--text-primary);
  font-weight: 700;
}

input[type="email"],
input[type="file"],
input[type="text"],
textarea,
select {
  background: #fffdf8;
  border: 1px solid var(--border-color);
  border-radius: calc(var(--radius) - 8px);
  color: var(--text-primary);
  font: inherit;
  margin-top: 0.25rem;
  min-height: 2.9rem;
  padding: 0.7rem 0.8rem;
  width: min(100%, 42rem);
}

textarea {
  min-height: 9rem;
  resize: vertical;
}

.card,
main > section:not(.hero):not(.steps) {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.5rem);
}

main > section + section {
  margin-top: 1.25rem;
}

.hero {
  align-items: center;
  display: grid;
  gap: clamp(2rem, 7vw, 5rem);
  grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
  min-height: 34rem;
}

.eyebrow {
  color: var(--accent-primary-hover);
  font-size: 0.85rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.review-note {
  color: var(--text-secondary);
  margin-top: 1rem;
}

.photo-stack {
  min-height: 28rem;
  position: relative;
}

.photo-card {
  border: 10px solid #fffdf8;
  border-bottom-width: 3rem;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  position: absolute;
}

.photo-card-back {
  background: repeating-linear-gradient(0deg, #fffaf2, #fffaf2 2rem, #efe1ce 2.05rem);
  height: 60%;
  right: 2rem;
  top: 0.5rem;
  transform: rotate(7deg);
  width: 72%;
}

.photo-card-front {
  background: #9bc4d0;
  bottom: 0;
  height: 78%;
  left: 0;
  overflow: hidden;
  transform: rotate(-4deg);
  width: 86%;
}

.photo-sky {
  background: linear-gradient(#8cb6c7, #f1c79b);
  height: 65%;
}

.photo-hill {
  background: var(--accent-secondary);
  border-radius: 50% 50% 0 0;
  bottom: 0;
  height: 45%;
  left: -10%;
  position: absolute;
  width: 120%;
}

.photo-sun {
  background: #f6d58b;
  border-radius: 50%;
  height: 4.25rem;
  position: absolute;
  right: 18%;
  top: 18%;
  width: 4.25rem;
}

.steps {
  margin-top: clamp(2rem, 7vw, 5rem);
}

.step-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
}

.step-card span {
  align-items: center;
  background: rgba(184, 92, 69, 0.12);
  border-radius: 50%;
  color: var(--accent-primary-hover);
  display: inline-flex;
  font-weight: 850;
  height: 2rem;
  justify-content: center;
  margin-bottom: 1rem;
  width: 2rem;
}

.step-card p {
  color: var(--text-secondary);
  margin-bottom: 0;
}

img {
  border-radius: calc(var(--radius) - 4px);
}

.workflow-page h1 {
  max-width: 13ch;
}

.workflow-page {
  max-width: 980px;
}

.progress-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
}

.progress-steps li {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 750;
  padding: 0.35rem 0.75rem;
}

.progress-steps .current {
  background: var(--accent-secondary);
  border-color: var(--accent-secondary);
  color: #fffaf2;
}

.field-prominent input[type="file"] {
  font-size: 1.1rem;
  padding: 1rem;
}

.field,
.field-prominent {
  margin-bottom: 1.1rem;
}

.help-text,
.form-note {
  color: var(--text-secondary);
  display: block;
  font-size: 0.95rem;
}

.required::after {
  color: var(--danger-color);
  content: " *";
}

.required-marker {
  color: var(--danger-color);
  font-weight: 800;
}

.field-error {
  color: var(--danger-color);
  display: block;
  font-weight: 700;
  margin-top: 0.35rem;
}

.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.form-section {
  border-top: 1px solid var(--border-color);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}

.field-row,
.preview-grid,
.status-grid {
  display: grid;
  gap: 1rem;
}

.field-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crop-workspace {
  margin: 1rem 0;
  max-height: 72vh;
  overflow: hidden;
}

#crop-photo {
  display: block;
  max-height: 72vh;
  max-width: 100%;
}

.preview-image {
  display: block;
  height: auto;
  max-width: 100%;
}

.postcard-preview-section article {
  min-width: 0;
}

.postcard-front-card {
  background: #fffdf8;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0;
  overflow: hidden;
  padding: 0.5rem;
}

.postcard-front-card figcaption {
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 0.6rem 0.25rem 0.1rem;
}

.postcard-back-card {
  aspect-ratio: 6 / 4;
  background: #fffdf8;
  border: 1px solid #c9b8a5;
  border-radius: calc(var(--radius) - 4px);
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 0.8fr;
  min-height: 16rem;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.message-preview {
  border-right: 1px solid #c9b8a5;
  overflow-wrap: anywhere;
  padding-right: 1rem;
  white-space: pre-wrap;
}

.message-preview h3,
.address-preview h3 {
  color: var(--text-secondary);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.address-preview {
  display: grid;
  gap: 1rem;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.stamp-placeholder {
  align-items: center;
  border: 2px dashed #c9b8a5;
  color: var(--text-secondary);
  display: flex;
  font-size: 0.8rem;
  height: 3.25rem;
  justify-content: center;
  justify-self: end;
  width: 4rem;
}

.postcard-back-card address {
  align-self: center;
  font-style: normal;
  overflow-wrap: anywhere;
}

.price,
.order-reference {
  font-size: 1.15rem;
  font-weight: 800;
}

.payment-choice,
.notice-panel,
.empty-state {
  overflow-wrap: anywhere;
}

.empty-state,
.notice-panel {
  color: var(--text-secondary);
}

@media (max-width: 760px) {
  .hero,
  .step-grid,
  .field-row,
  .preview-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .photo-stack {
    min-height: 20rem;
  }

  h1 {
    font-size: clamp(2.25rem, 13vw, 3.5rem);
  }

  main {
    padding-block: 1.5rem 2.5rem;
  }

  .actions,
  .actions .button,
  .actions input[type="submit"],
  .button_to,
  .button_to button {
    width: 100%;
  }

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

  .progress-steps li {
    text-align: center;
  }

  input[type="email"],
  input[type="file"],
  input[type="text"],
  textarea,
  select {
    width: 100%;
  }

  .crop-workspace,
  #crop-photo {
    max-height: 58vh;
  }

  .postcard-back-card {
    aspect-ratio: auto;
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .message-preview {
    border-bottom: 1px solid #c9b8a5;
    border-right: 0;
    padding-bottom: 1rem;
    padding-right: 0;
  }
}

.print-warning {
  border-left: 3px solid var(--accent-primary);
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
}

.print-guide,
.preview-guide {
  box-sizing: border-box;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.print-trim-guide,
.preview-trim {
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.print-safe-guide,
.preview-safe {
  border: 2px dashed rgba(255, 214, 10, 0.95);
}

.postcard-preview {
  background: #eee;
  margin: 0;
  max-width: 750px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.postcard-preview > img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.preview-guide span {
  background: rgba(0, 0, 0, 0.72);
  color: white;
  font: 12px/1 sans-serif;
  padding: 3px 5px;
  position: absolute;
}

.preview-safe span {
  bottom: 0;
  right: 0;
}

.print-legend {
  font-size: 0.9rem;
}

.postcard-back {
  background: white;
  border: 1px solid #bbb;
  font-family: Arial, sans-serif;
}

.back-message,
.address-area {
  box-sizing: border-box;
  overflow: hidden;
  position: absolute;
}

.back-message {
  font-size: clamp(7px, 2vw, 16px);
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.back-message p {
  margin: 0;
}

.address-area {
  align-items: center;
  background: repeating-linear-gradient(-45deg, #f8d7da, #f8d7da 8px, #fff 8px, #fff 16px);
  border: 2px solid #b42318;
  color: #7a271a;
  display: flex;
  font-size: clamp(7px, 1.5vw, 13px);
  font-weight: bold;
  justify-content: center;
  padding: 1rem;
  text-align: center;
}

.preflight {
  border: 1px solid;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
}

.preflight-pass {
  background: #ecfdf3;
  border-color: #067647;
}

.preflight-fail {
  background: #fef3f2;
  border-color: #b42318;
}

.admin-body {
  background: #f5eadb;
}

.admin-header,
.admin-main,
.admin-flash-messages {
  margin-inline: auto;
  max-width: var(--content-width);
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.admin-header {
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 3.75rem;
}

.admin-brand {
  color: var(--text-primary);
  font-weight: 850;
  text-decoration: none;
}

.admin-nav,
.admin-filter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-nav a,
.admin-filter-nav a {
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 750;
  padding: 0.35rem 0.7rem;
  text-decoration: none;
}

.admin-nav a:hover,
.admin-filter-nav a:hover,
.admin-filter-nav .current {
  background: rgba(77, 119, 114, 0.12);
}

.admin-main {
  padding-block: 1.5rem 2.5rem;
}

.admin-flash-messages {
  padding-top: 1rem;
}

.admin-page-header {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.admin-eyebrow {
  color: var(--accent-primary-hover);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.admin-body h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.055em;
  line-height: 1;
  max-width: none;
}

.admin-body h2 {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  letter-spacing: -0.025em;
}

.admin-body h3 {
  margin-top: 0;
}

.admin-card {
  background: rgba(255, 250, 242, 0.82);
  border: 1px solid var(--border-color);
  border-radius: calc(var(--radius) - 4px);
  box-shadow: 0 8px 24px rgba(80, 55, 32, 0.08);
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.35rem);
}

.admin-section-header {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.admin-section-header h2,
.admin-section-header p {
  margin-bottom: 0;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--border-color);
  padding: 0.7rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--text-secondary);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-table td {
  overflow-wrap: anywhere;
}

.admin-table tr.needs-attention td {
  background: rgba(184, 92, 69, 0.06);
}

.admin-badge,
.admin-attention {
  border: 1px solid currentColor;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
  padding: 0.24rem 0.55rem;
  white-space: nowrap;
}

.admin-badge-success {
  background: rgba(6, 118, 71, 0.09);
  color: var(--success-color);
}

.admin-badge-danger {
  background: rgba(180, 35, 24, 0.09);
  color: var(--danger-color);
}

.admin-badge-warning,
.admin-attention {
  background: rgba(184, 92, 69, 0.1);
  color: var(--accent-primary-hover);
}

.admin-badge-muted {
  background: rgba(111, 98, 86, 0.1);
  color: var(--text-secondary);
}

.admin-attention {
  margin-top: 0.35rem;
}

.admin-definition-grid,
.admin-definition-list {
  display: grid;
  gap: 0.8rem;
  margin: 0;
}

.admin-definition-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-definition-list div,
.admin-definition-grid div {
  min-width: 0;
}

.admin-definition-list dt,
.admin-definition-grid dt {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-definition-list dd,
.admin-definition-grid dd {
  margin: 0.2rem 0 0;
  overflow-wrap: anywhere;
}

.admin-action-group {
  align-items: start;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-action-note {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
  max-width: 18rem;
}

.admin-reject-form {
  background: transparent;
  border: 0;
  box-shadow: none;
  margin-top: 1rem;
  padding: 0;
}

.admin-reject-form input[type="text"] {
  width: min(100%, 34rem);
}

.admin-panel-success {
  border-color: rgba(6, 118, 71, 0.45);
}

.admin-panel-warning {
  border-color: rgba(184, 92, 69, 0.55);
}

.admin-preview-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-postcard-preview {
  max-width: 520px;
}

.admin-empty-state {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.admin-event-list {
  border-left: 2px solid var(--border-color);
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
}

.admin-event-list li {
  margin-bottom: 1rem;
  overflow-wrap: anywhere;
  position: relative;
}

.admin-event-list li::before {
  background: var(--accent-secondary);
  border: 2px solid var(--surface-bg);
  border-radius: 50%;
  content: "";
  height: 0.65rem;
  left: -1.42rem;
  position: absolute;
  top: 0.45rem;
  width: 0.65rem;
}

.admin-event-list time {
  color: var(--text-secondary);
  display: block;
  font-size: 0.86rem;
}

.admin-event-list p {
  margin-bottom: 0.35rem;
}

.admin-technical-block {
  background: #fffdf8;
  border: 1px solid var(--border-color);
  border-radius: calc(var(--radius) - 8px);
  overflow-x: auto;
  overflow-wrap: anywhere;
  padding: 0.75rem;
  white-space: pre-wrap;
}

.admin-original-photo {
  display: block;
  height: auto;
  max-width: min(100%, 520px);
}

.admin-card details + details {
  margin-top: 0.75rem;
}

.admin-card summary {
  cursor: pointer;
  font-weight: 800;
}

.admin-body button:disabled,
.admin-body input[type="submit"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 760px) {
  .admin-header,
  .admin-page-header,
  .admin-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-nav,
  .admin-filter-nav {
    width: 100%;
  }

  .admin-filter-nav a {
    background: rgba(255, 250, 242, 0.72);
  }

  .admin-definition-grid,
  .admin-preview-grid {
    grid-template-columns: 1fr;
  }

  .admin-action-group,
  .admin-action-group .button_to,
  .admin-action-group button,
  .admin-action-group input[type="submit"],
  .admin-reject-form input[type="submit"] {
    width: 100%;
  }
}
