:root {
  --accent: #e8590c;
  --theme-bg: #fff4e6;
  --banner: linear-gradient(135deg, #ff922b, #f06595, #845ef7);
  --text: #212529;
  --muted: #6c757d;
  --line: #e9ecef;
  --card: #fff;
  --danger: #c92a2a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--theme-bg);
}
body.host { background: #f1f3f5; }
a { color: var(--accent); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .4rem; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1rem 0 .3rem; }
p { margin: 0 0 .8rem; }
img { max-width: 100%; }

.wrap { max-width: 680px; margin: 0 auto; padding: 16px 16px 60px; }
.wrap.wide { max-width: 1100px; }
.wrap.narrow { max-width: 420px; padding-top: 10vh; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.strike { text-decoration: line-through; }
.grow { flex: 1; min-width: 0; }
.warn { color: #e67700; }
.danger { color: var(--danger) !important; }
[hidden] { display: none !important; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.04);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; gap: 14px; align-items: center; }

/* forms */
label { display: block; margin: 0 0 12px; font-weight: 600; font-size: .92rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid #ced4da; border-radius: 10px; font: inherit; font-weight: 400; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
label.indent { margin-left: 26px; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.hint { background: #fff9db; padding: 8px 12px; border-radius: 8px; font-size: .9rem; }

.btn {
  display: inline-block; border: 2px solid var(--accent); background: var(--accent); color: #fff;
  padding: 10px 20px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: #fff; color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-small { padding: 5px 14px; font-size: .88rem; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.btn-row form, form.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 10px; }

.flash { background: #d3f9d8; color: #2b8a3e; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.flash-error { background: #ffe3e3; color: var(--danger); }
.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .72rem; font-weight: 700; vertical-align: middle; }

/* guest page */
.hero { margin: 0 -16px; }
.hero-img { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--theme-bg); }
.hero-banner { height: 200px; background: var(--banner); display: grid; place-items: center; font-size: 80px; }
.event-card { margin-top: -30px; position: relative; }
.event-card h1 { font-size: 2.1rem; }
.detail { display: flex; gap: 12px; margin: 14px 0; }
.detail .icon { font-size: 1.3rem; line-height: 1.4; }
.description { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
@media (min-width: 720px) {
  .hero { margin: 0; }
  .hero-img, .hero-banner { border-radius: var(--radius) var(--radius) 0 0; }
  .event-card { margin-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
}

.rsvp-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 16px; }
.choice { margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block; text-align: center; padding: 14px 6px; border: 2px solid var(--line); border-radius: 12px;
  cursor: pointer; font-size: 1.05rem; transition: all .15s;
}
.choice input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, #fff); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); }
.party { display: flex; gap: 14px; }
.party label { flex: 1; }
.guest-names { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.guest-names li { background: #f1f3f5; padding: 3px 12px; border-radius: 999px; font-size: .9rem; }
.comments { list-style: none; padding: 0; margin: 12px 0 0; }
.comments li { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.comments p { margin: 4px 0; white-space: pre-wrap; }
.comment-form { margin-bottom: 8px; }
.comment-form label { margin-bottom: 4px; }
.comment-form.host-post { display: flex; gap: 8px; align-items: flex-start; }
.comment-form.host-post textarea { margin: 0; }
.card > .flash:first-child, .card > h2 + .flash { margin-top: 0; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* host */
.list { padding: 6px; }
.event-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 10px; color: inherit; text-decoration: none; }
.event-row:hover { background: #f8f9fa; }
.swatch { width: 56px; height: 56px; border-radius: 10px; display: grid; place-items: center; font-size: 26px; overflow: hidden; flex: none; }
.swatch img { width: 100%; height: 100%; object-fit: cover; }
.swatch.big { width: 96px; height: 96px; font-size: 44px; }
.counts { display: flex; gap: 12px; white-space: nowrap; }
.manage-head { display: flex; gap: 18px; align-items: center; margin: 10px 0 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 14px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .82rem; }
.grid-manage { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.copy { display: flex; gap: 8px; align-items: center; }
.copy input { margin: 0; }
.table-wrap { overflow-x: auto; }
table.guests { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.guests th { text-align: left; font-size: .78rem; text-transform: uppercase; color: var(--muted); padding: 8px 6px; border-bottom: 2px solid var(--line); }
table.guests td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.guests td.note { max-width: 220px; font-size: .85rem; color: #495057; }
.status-select { margin: 0 !important; padding: 5px 8px !important; width: auto !important; font-size: .88rem !important; }
.status-yes { background: #ebfbee !important; }
.status-no { background: #fff5f5 !important; }
.status-maybe { background: #fff9db !important; }
.danger-zone { border: 1px solid #ffc9c9; }
.danger-zone form { margin-bottom: 12px; }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-bottom: 18px; }
.theme-pick { margin: 0; text-align: center; font-weight: 400; cursor: pointer; }
.theme-pick input { position: absolute; opacity: 0; }
.theme-pick span { display: grid; place-items: center; height: 60px; border-radius: 10px; font-size: 28px; border: 3px solid transparent; }
.theme-pick input:checked + span { border-color: var(--text); }
.upload { display: grid; gap: 8px; }
.upload img { max-height: 220px; border-radius: 10px; object-fit: cover; }

@media (max-width: 720px) {
  .grid2, .grid-manage { grid-template-columns: 1fr; }
  .rsvp-choices { gap: 6px; }
  .manage-head { flex-direction: column; align-items: flex-start; }
  .event-row { flex-wrap: wrap; }
  .counts { width: 100%; padding-left: 70px; }
  h1 { font-size: 1.6rem; }
}
