:root {
  --bg: #e7e1d6;
  --ink: #1c1915;
  --muted: #5e584f;
  --line: rgba(28, 25, 21, 0.1);
  --green: #1e3f38;
  --green-2: #2c5a50;
  --brass: #6d5733;
  --paper: rgba(255, 252, 247, 0.92);
  --danger: #8c342c;
  --shadow: 0 22px 50px rgba(55, 40, 16, 0.08);
  --serif: "Source Serif 4", "Palatino Linotype", Palatino, serif;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.45;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(166, 132, 86, 0.22), transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(30, 63, 56, 0.09), transparent 50%),
    var(--bg);
}

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

::selection { background: #d5e4df; }

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 3rem;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
  margin-bottom: 1.4rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--brass);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.1rem, 4vw, 3.15rem);
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.lead {
  max-width: 40rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.privacy {
  max-width: 16rem;
  margin: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.55);
  color: var(--muted);
  font-size: 0.92rem;
}

.noscript {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #fff4e8;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 1.15rem;
  align-items: start;
}

.sheet {
  background: var(--paper);
  border: 1px solid rgba(28, 25, 21, 0.08);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.35rem;
}

.panel { position: sticky; top: 1rem; }

.form-tools {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

fieldset {
  border: 0;
  margin: 0 0 1.35rem;
  padding: 0;
  min-inline-size: 0;
}

legend {
  margin-bottom: 0.75rem;
  padding: 0;
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  min-width: 0;
}

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

.field > span {
  font-size: 0.92rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 0.68rem 0.75rem;
  border: 1px solid #d9d0c3;
  border-radius: 10px;
  background: #fffdf9;
  outline: none;
}

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

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(30, 63, 56, 0.15);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(140, 52, 44, 0.12);
}

input::placeholder,
textarea::placeholder { color: #8a8176; }

.hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.field-error,
.form-error {
  margin: 0.2rem 0 0;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.form-error { margin-bottom: 0.55rem; }

.text-btn {
  padding: 0.15rem 0;
  border: 0;
  background: none;
  color: var(--green);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.text-btn.danger { color: var(--danger); }

.text-btn:hover { color: var(--green-2); }

.photo-box {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem;
  border: 1px dashed #cfc6b8;
  border-radius: 14px;
  background: #fffdf9;
}

.photo-box.is-drag {
  border-color: var(--green);
  background: #f2f7f5;
}

.photo-copy { min-width: 0; }

.photo-copy .hint { margin-top: 0.25rem; }

.photo-thumb,
.biz-photo {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  background: #efe8dc;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.biz {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 1.15rem 1.15rem 1.1rem 1.35rem;
  border: 1px solid rgba(28, 25, 21, 0.08);
  border-radius: 18px;
  background: #fffdf9;
}

.biz::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(#1e3f38, #3d6b60);
}

.biz-top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}

.biz-kicker {
  margin: 0 0 0.3rem;
  color: var(--brass);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.biz-name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 2vw, 2.15rem);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.biz.is-empty .biz-name { color: #b7b0a4; font-weight: 500; }

.biz-role {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.biz-photo {
  width: 72px;
  height: 72px;
  box-shadow: 0 0 0 1px rgba(28, 25, 21, 0.12);
}

.biz-rule {
  width: 2.4rem;
  height: 2px;
  margin: 0.9rem 0 0.8rem;
  background: #c4a574;
}

.biz-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.biz-list li {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 0.45rem;
  align-items: start;
  font-size: 0.95rem;
}

.biz-list li > * { min-width: 0; }

.biz-list span {
  padding-top: 0.16rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.biz-list a,
.biz-list div {
  overflow-wrap: anywhere;
}

.biz-list a {
  color: inherit;
  text-underline-offset: 0.15em;
}

.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  margin-top: 1rem;
}

.qr-frame {
  display: grid;
  place-items: center;
  min-width: 220px;
  min-height: 220px;
  padding: 0.65rem;
  border: 1px solid rgba(28, 25, 21, 0.08);
  border-radius: 16px;
  background: #fff;
}

.qr-frame canvas {
  width: 220px;
  height: auto;
  image-rendering: pixelated;
}

.qr-empty {
  max-width: 14rem;
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
}

.actions { margin-top: 1rem; }

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.btn {
  appearance: none;
  border-radius: 999px;
  padding: 0.82rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-primary {
  border: 0;
  background: var(--green);
  color: #f6f3ec;
}

.btn-primary:hover:not(:disabled) { background: var(--green-2); }

.btn-secondary {
  border: 1px solid var(--green);
  background: transparent;
  color: var(--green);
}

.btn-secondary:hover:not(:disabled) { background: rgba(30, 63, 56, 0.06); }

.btn-compact {
  padding: 0.55rem 0.95rem;
  font-size: 0.95rem;
}

.btn:focus-visible,
.text-btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.code-block { margin-top: 1rem; }

.code-block summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 600;
}

.vcf-code {
  max-height: 220px;
  overflow: auto;
  margin: 0.7rem 0 0;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  background: #221f1b;
  color: #f3ecdf;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 20;
  transform: translateX(-50%);
  max-width: min(32rem, calc(100% - 2rem));
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #f6f3ec;
  box-shadow: var(--shadow);
  text-align: center;
}

@media (max-width: 960px) {
  .top { flex-direction: column; align-items: start; }
  .privacy { max-width: none; }
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
  .actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    margin: 0;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(246, 243, 236, 0.96);
    backdrop-filter: blur(10px);
  }
  body { padding-bottom: 7.5rem; }
  .toast { bottom: 7.2rem; }
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .field-span { grid-column: auto; }
  .action-row { grid-template-columns: 1fr; }
  .biz-list li { grid-template-columns: 5.8rem minmax(0, 1fr); }
}
