:root {
  --bg: #F6F7F9; --surface: #FFFFFF; --text: #1C2430; --muted: #5F6B7A;
  --line: #E2E6EB; --accent: #2B5FD9; --accent-soft: #EAF0FD; --note: #FFF6E0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161C; --surface: #1A2028; --text: #E6EAF0; --muted: #98A3B3;
    --line: #2A323D; --accent: #7BA2FF; --accent-soft: #1F2A40; --note: #2E2818;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
.wrap { max-width: 640px; margin: 0 auto; padding: 48px 16px; }
h1 { margin: 0 0 8px; font-size: clamp(24px, 5vw, 32px); letter-spacing: -.01em; }
.kicker { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); }
.muted { color: var(--muted); margin: 0 0 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-top: 16px; }
.card p { margin: 0 0 12px; }
.card p:last-child { margin-bottom: 0; }
.contact { background: var(--note); border-radius: 10px; padding: 12px 14px; font-size: 14px; }

/* Product pages (customer and admin) */
.wrap.wide { max-width: 1120px; }
.product-head { margin-bottom: 20px; }
.product-head .muted { margin-bottom: 8px; }
.note { margin: 0; font-weight: 600; }
.small { font-size: 13px; }
.product { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .product { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: start; }
  .preview { position: sticky; top: 16px; }
}
fieldset { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 0 0 16px; padding: 16px; }
legend { font-weight: 600; padding: 0 6px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: span 1; }
@media (max-width: 420px) { .field.half { grid-column: 1 / -1; } }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
input[type=text], input[type=number], input[type=date], input[type=time], textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint, .counter { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.counter { text-align: right; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
label.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.consent { background: var(--note); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.errors { color: #B3261E; background: #FCEDEC; border-radius: 10px; padding: 10px 14px 10px 30px; margin: 0 0 12px; font-size: 14px; }
@media (prefers-color-scheme: dark) { .errors { color: #FFB4AB; background: #3B1714; } }
.button { display: inline-block; width: 100%; font: inherit; font-size: 17px; font-weight: 600; color: #fff;
  background: var(--accent); border: 0; border-radius: 10px; padding: 13px 18px; cursor: pointer; }
.button:disabled { opacity: .6; cursor: progress; }
.button.secondary { color: var(--accent); background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.buttons { display: grid; gap: 10px; }
#status { margin: 10px 0 0; min-height: 1.5em; }
.preview h2 { font-size: 16px; margin: 0 0 8px; }
.preview-frame { position: relative; overflow: hidden; border-radius: 8px; background: #E9ECEF; min-height: 200px; }
.preview-frame iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; pointer-events: none; }
.tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.tiles a { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: inherit; text-decoration: none; }
.tiles a:hover { border-color: var(--accent); }
.tiles small { color: var(--muted); }

.codes-form .fields { margin-bottom: 16px; }
.issued { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre; }

/* Online RSVP: switch on the customer form, guest page, guest list */
.rsvp-box .hint { margin: 6px 0 0; }
.rsvp-result { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #E9F6EF; color: #17402D; }
.rsvp-result p { margin: 0 0 4px; overflow-wrap: anywhere; }
.rsvp-result a { font-weight: 600; }
.rsvp-page h2 { font-size: 20px; margin: 0 0 8px; }
.rsvp-page .card { margin-top: 16px; }
.rsvp-card { margin: 16px 0 0; text-align: center; }
.rsvp-card img { width: 100%; max-width: 420px; height: auto; border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); }
.rsvp-form form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 12px; }
.rsvp-form .field input, .rsvp-form .field textarea { width: 100%; box-sizing: border-box; }
.answer { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; min-width: 0; }
.answer legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.choice { display: flex; align-items: center; gap: 8px; padding: 12px; border: 2px solid #D9DCE1; border-radius: 12px;
  cursor: pointer; font-weight: 600; }
.choice:has(input:checked).yes { border-color: #2E8B57; background: #E9F6EF; }
.choice:has(input:checked).no { border-color: #B5543C; background: #FBEDE8; }
.rsvp-saved { padding: 12px 14px; border-radius: 10px; background: #E9F6EF; color: #17402D; }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-row input { flex: 1 1 220px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.share-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.share-links .button { width: auto; text-decoration: none; text-align: center; }
.rsvp-counts { display: flex; gap: 16px; font-size: 18px; margin: 0 0 12px; }
.count.yes b { color: #2E8B57; } .count.no b { color: #B5543C; }
.reply-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.reply-list li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 12px;
  border-radius: 10px; border-left: 4px solid #2E8B57; background: rgba(46, 139, 87, .06); }
.reply-list li.no { border-left-color: #B5543C; background: rgba(181, 84, 60, .06); }
.reply-list li p { margin: 2px 0 0; }
.reply-list .answer-text { font-size: 14px; color: inherit; opacity: .75; display: inline; }
.reply-note { font-style: italic; overflow-wrap: anywhere; }
.link-button { background: none; border: 0; padding: 4px; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; font-size: 14px; }
.link-button.danger { color: #B5543C; }
@media (prefers-color-scheme: dark) {
  .rsvp-result, .rsvp-saved { background: #173326; color: #CDEBDB; }
  .choice:has(input:checked).yes { background: #173326; } .choice:has(input:checked).no { background: #3A221E; }
}

/* Choice as picture tiles (invitation designs) */
.option-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.option-tile { position: relative; display: grid; gap: 6px; justify-items: center; cursor: pointer; font-size: 14px;
  font-weight: 600; text-align: center; }
.option-tile input { position: absolute; opacity: 0; pointer-events: none; }
.option-tile img { width: 100%; height: auto; aspect-ratio: 105 / 148.5; object-fit: cover; border-radius: 8px;
  border: 2px solid transparent; outline: 1px solid rgba(0, 0, 0, .12); background: #F3F4F6; transition: transform .12s ease; }
.option-tile:hover img { transform: translateY(-2px); }
.option-tile input:checked + img { border-color: var(--accent, #D9483B); outline-color: transparent;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #D9483B) 25%, transparent); }
.option-tile input:focus-visible + img { outline: 3px solid var(--accent, #D9483B); outline-offset: 2px; }
.option-tile input:checked ~ span::before { content: "✓ "; color: var(--accent, #D9483B); }

.page-footer { padding-top: 0; padding-bottom: 24px; font-size: 13px; color: var(--muted); text-align: center; }
.page-footer a { color: inherit; }
.card.warning { border-left: 4px solid #D9483B; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Item editor (manifest "list", admin panel) */
.item-editor { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.item-editor-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.item-editor-head h2 { margin: 0; font-size: 20px; }
.item-editor-head p { margin: 0; }
.item-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 8px; }
.item-toolbar .button.small { width: auto; padding: 6px 12px; font-size: 13px; min-height: 0; }
.item-editor > .hint { margin: 0 0 12px; }
#items { display: grid; gap: 8px; margin-bottom: 16px; }
details.item { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
details.item[open] { box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
details.item summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
details.item summary::-webkit-details-marker { display: none; }
.item-number { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
.item-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { flex: none; font-size: 12px; color: var(--muted); }
.item-meta .edited { color: var(--accent); font-weight: 600; }
.item-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 4px 12px 8px; }
.item-body > p { grid-column: 1 / -1; margin: 0; }
.item-body .field.toggle { align-self: end; padding-bottom: 22px; }
@media (max-width: 420px) { .item-body { grid-template-columns: 1fr; } }
.counter.warn { color: #B7791F; }
.counter.over { color: #C53030; font-weight: 600; }

/* Admin tables (orders) */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { font-weight: 600; color: var(--muted); }
.admin-table tr.muted td { color: var(--muted); }
