:root {
  --bg: #f4ede3;
  --bg-deep: #e6d6c0;
  --panel: rgba(255, 250, 242, 0.88);
  --panel-strong: #fffaf3;
  --line: rgba(92, 55, 25, 0.14);
  --ink: #1d1b1a;
  --muted: #61544d;
  --accent: #a33d2b;
  --accent-deep: #6d2112;
  --accent-soft: #f7d5bf;
  --secondary: #0d5c63;
  --secondary-soft: #d7f0ed;
  --shadow: 0 24px 60px rgba(77, 39, 20, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(240,240,240,0.78)),
    url("/static/images/hero-bg.jpg") center center / cover fixed no-repeat;
  color: var(--ink);
  font-family: var(--font-body);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.background-orb {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(22px);
  pointer-events: none;
}

.orb-one {
  top: 2rem;
  right: 6rem;
  width: 18rem;
  height: 18rem;
  background: rgba(163, 61, 43, 0.16);
}

.orb-two {
  left: -3rem;
  bottom: 5rem;
  width: 22rem;
  height: 22rem;
  background: rgba(13, 92, 99, 0.14);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1400px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 248, 238, 0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-copy {
  display: grid;
  gap: 0.15rem;
}

.brand-copy strong,
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
}

.brand-copy small,
.muted,
.lead,
small {
  color: var(--muted);
}

.site-nav,
.action-row,
.form-actions,
.tag-row,
.flash-stack,
.asset-grid {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.nav-form {
  display: inline-flex;
}

.nav-user {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 240, 0.85);
  color: var(--muted);
  font-size: 0.88rem;
}

.compact-actions {
  margin-top: 0.9rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.9rem;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(76, 38, 19, 0.12);
}

.button.primary {
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
}

.button.secondary {
  background: rgba(255, 248, 240, 0.85);
  color: var(--ink);
  border-color: var(--line);
}

.button.tertiary {
  background: var(--secondary-soft);
  color: var(--secondary);
}

.button.danger {
  background: #fde8e8;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.button.danger:hover {
  background: #fca5a5;
}

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

.card-actions-row .button { flex-shrink: 0; }
.card-actions-row form { margin: 0; }

.ready-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  flex: 1;
  white-space: nowrap;
}

.ready-checkbox-label:has(.ready-checkbox:checked) {
  color: #15803d;
  font-weight: 600;
}

.ready-checkbox {
  accent-color: #16a34a;
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.full-width {
  width: 100%;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
  gap: 1.5rem;
  padding: 1rem 2rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.hero-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

.hero-metrics,
.record-grid,
.detail-grid,
.field-grid,
.detail-list,
.class-row,
.class-detail-stack {
  display: grid;
  gap: 1rem;
}

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

.metric-card,
.record-card,
.class-detail-card,
.file-tile {
  background: rgba(255, 251, 246, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.metric-card {
  padding: 1.15rem;
}

.metric-card.accent {
  background: linear-gradient(145deg, rgba(13, 92, 99, 0.14), rgba(13, 92, 99, 0.05));
}

.metric-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
}

.metric-label,
.small {
  font-size: 0.94rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  color: var(--accent-deep);
}

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

h1 {
  margin-bottom: 0.8rem;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.98;
}

h2 {
  margin-bottom: 0.4rem;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1.25rem;
}

.lead {
  max-width: 58ch;
  font-size: 1.03rem;
  line-height: 1.7;
}

.panel {
  padding: 1.6rem;
  margin-bottom: 1.5rem;
}

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

.panel-header.compact {
  margin-bottom: 1.1rem;
}

.record-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.record-card {
  padding: 1.2rem;
}

.record-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.record-id,
.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}

.record-id,
.status-pill {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.record-id {
  background: rgba(163, 61, 43, 0.1);
  color: var(--accent-deep);
}

.status-pill {
  background: rgba(13, 92, 99, 0.12);
  color: var(--secondary);
}

.tag {
  padding: 0.3rem 0.65rem;
  background: rgba(13, 92, 99, 0.08);
  color: var(--secondary);
  font-size: 0.84rem;
}

.class-summary { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
.class-summary-row { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.goods-snippet { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }

.empty-state,
.narrow-panel,
.page-intro,
.detail-hero {
  text-align: left;
}

.narrow-panel {
  max-width: 760px;
  margin-inline: auto;
}

.empty-state {
  padding: 1rem 0 0.2rem;
}

.flash {
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 249, 240, 0.88);
}

.flash-success {
  background: rgba(215, 240, 237, 0.9);
  color: var(--secondary);
}

.flash-warning {
  background: rgba(255, 244, 214, 0.94);
  color: #76510f;
  border-color: rgba(118, 81, 15, 0.18);
}

.error-panel {
  border-color: rgba(163, 61, 43, 0.26);
  background: rgba(255, 238, 232, 0.88);
}

.error-list {
  margin: 0;
  padding-left: 1.25rem;
}

.inline-error-panel {
  margin-bottom: 1rem;
}

.form-stack,
.class-row-stack {
  display: grid;
  gap: 1.25rem;
}

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

.field,
.choice-card {
  display: grid;
  gap: 0.45rem;
}

.field span,
.choice-card span,
dt {
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(94, 69, 55, 0.16);
  border-radius: 1rem;
  background: rgba(255, 252, 247, 0.94);
  color: var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 7rem;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgba(163, 61, 43, 0.18);
  border-color: rgba(163, 61, 43, 0.36);
}

.span-two {
  grid-column: 1 / -1;
}

/* Mark section two-column layout */
.mark-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.mark-image-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.mark-meta-col {
  display: flex;
  flex-direction: column;
}
.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mark-drop-zone {
  width: 200px;
  height: 200px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,252,247,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}
.mark-drop-zone .file-thumb-preview {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mark-drop-zone .file-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.mark-drop-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.mark-drop-placeholder svg { opacity: 0.45; }
.mark-file-btn-wrap {
  position: relative;
  margin-top: 0.25rem;
  display: inline-block;
}
.mark-file-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.radio-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0;
}

.choice-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 247, 0.85);
}

.choice-card input {
  margin: 0;
}


.class-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 247, 0.7);
  margin-bottom: 1.5rem;
}

.goods-editor-fullwidth {
  width: 100%;
  margin-left: 0;
  padding-left: 0;
}

.goods-table-wrap {
  margin-left: 0;
  padding-left: 0;
}

.compact-field {
  min-width: 0;
}

.grow-field {
  min-width: 0;
}

.goods-editor {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.remove-row {
  justify-self: start;
  align-self: start;
  white-space: nowrap;
}

.goods-import-field {
  margin: 0;
}

.goods-import-input {
  min-height: 5.5rem;
}

.sample-link-list {
  display: block;
}

.file-thumb-preview {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.55rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 247, 0.9);
}

.file-thumb-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 6px;
  background: #f4ede3;
  flex-shrink: 0;
}

.file-thumb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.file-thumb-name {
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-all;
}

.sample-previews-row {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.sample-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  background: rgba(255, 252, 247, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(92, 55, 25, 0.06);
  padding: 0.35rem 0.35rem 0.3rem;
}

.sample-preview-img {
  width: 82px;
  height: 108px;
  object-fit: contain;
  border-radius: 6px;
  background: #f4ede3;
  margin-bottom: 0.3rem;
  box-shadow: 0 1px 3px rgba(92, 55, 25, 0.08);
}

.sample-preview-meta {
  text-align: center;
  font-size: 0.74rem;
  margin-top: 0.1rem;
  word-break: break-all;
}

.sample-link-list a {
  white-space: nowrap;
}

.goods-editor-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.goods-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 247, 0.82);
}

.goods-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1080px;
  table-layout: fixed;
  font-size: 0.88rem;
}

.goods-table col.goods-col-index {
  width: 3rem;
}

.goods-table col.goods-col-entry {
  width: 49%;
}

.goods-table col.goods-col-status {
  width: 15%;
}

.goods-table col.goods-col-alternatives {
  width: 22%;
}

.goods-table col.goods-col-actions {
  width: 10%;
}

.goods-th-index,
.goods-index-cell {
  text-align: right;
  padding-right: 0.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  user-select: none;
}

.goods-table th,
.goods-table td {
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.goods-table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.goods-table th:last-child,
.goods-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: -1px 0 0 rgba(94, 69, 55, 0.12);
  white-space: nowrap;
}

.goods-table th:last-child {
  z-index: 2;
}

.goods-item-input {
  width: 100%;
  min-width: 26rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(94, 69, 55, 0.16);
  border-radius: 0.9rem;
  background: rgba(255, 252, 247, 0.94);
  font-size: 0.92rem;
}

.goods-status {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.goods-status-empty {
  background: rgba(94, 69, 55, 0.08);
  color: var(--muted);
}

.goods-status-acceptable {
  background: rgba(13, 92, 99, 0.16);
  color: var(--secondary);
}

.goods-status-warning {
  background: rgba(225, 178, 74, 0.18);
  color: #7a5410;
}

.goods-status-not-acceptable {
  background: rgba(163, 61, 43, 0.14);
  color: var(--accent-deep);
}

.goods-status-detail,
.goods-alternatives {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
  min-height: 1.4rem;
}

.goods-alternatives {
  overflow-wrap: anywhere;
}

.goods-normalized {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

.goods-remove-button {
  min-width: 0;
  white-space: nowrap;
}

.auth-panel .lead {
  max-width: 54ch;
}

.auth-note-stack {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1.5rem;
}

.detail-card {
  height: 100%;
}

.wide-card {
  width: 100%;
}

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

.detail-list div {
  padding: 0.95rem 0;
  border-top: 1px solid var(--line);
}

dt {
  margin-bottom: 0.25rem;
  color: var(--muted);
}

dd {
  margin: 0;
  font-size: 1rem;
}

.preserve-lines {
  white-space: pre-wrap;
}

.file-tile {
  display: grid;
  gap: 0.2rem;
  padding: 1rem;
}

.image-preview-wrap {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid var(--line);
}

.image-preview {
  max-width: 100%;
  max-height: 360px;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

.class-detail-card {
  padding: 1rem 1.1rem;
}

.class-detail-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.class-detail-heading p {
  margin: 0;
  color: var(--muted);
}

.goods-text {
  line-height: 1.65;
}

.goods-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.65;
}

.goods-list li + li {
  margin-top: 0.35rem;
}

@media (max-width: 960px) {
  .hero-card,
  .detail-grid,
  .field-grid.two-column,
  .detail-list,
  .class-row {
    grid-template-columns: 1fr;
  }

  .site-header,
  .panel-header,
  .detail-hero {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 1rem, 100%);
    padding-top: 0.7rem;
  }

  .site-header {
    border-radius: 1.4rem;
    padding: 1rem;
  }

  .hero-card,
  .panel {
    padding: 1.2rem;
  }

  h1 {
    line-height: 1.04;
  }
}

/* ── Sample forms page ─────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.35rem; font-size: 1.7rem; }
.page-subtitle { color: var(--muted); margin: 0; }

.prose { padding: 0 1.5rem 1.5rem; line-height: 1.65; color: var(--fg); }
.prose h3 { margin: 1.25rem 0 0.4rem; font-size: 1rem; color: var(--accent-deep); }
.prose p { margin: 0.4rem 0; }
.prose ul { margin: 0.4rem 0 0.4rem 1.25rem; padding: 0; }
.prose li { margin-bottom: 0.25rem; }
.prose code { font-size: 0.84em; background: rgba(0,0,0,0.06); border-radius: 3px; padding: 0.1em 0.3em; }

.sample-gallery { display: flex; flex-wrap: wrap; gap: 1.5rem; padding: 1rem 1.5rem 1.5rem; }
.sample-gallery-card { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.sample-gallery-thumb-link { display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.sample-gallery-img { display: block; width: 220px; height: auto; }
.sample-gallery-meta { }
.button.small { padding: 0.3rem 0.75rem; font-size: 0.82rem; }