/* ===== Site styles ===== */
:root {
  --brand: #7048e8; --brand-dark: #5f3dc4; --ink: #2b2240; --muted: #7a7290; --line: #e9e4f2;
  --bg: #f7f5fb; --panel: #fff; --yes: #2f9e44; --maybe: #f08c00; --no: #e03131; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 1.8rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }
code { background: #efeaf8; padding: 1px 6px; border-radius: 4px; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.warn-text { color: var(--maybe); font-size: .82rem; margin: 6px 0 0; }
.err { color: var(--no); }

/* layout */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; flex-wrap: wrap; }
.brand { font-family: 'Pacifico', cursive; font-size: 1.5rem; color: var(--brand); }
.brand:hover { text-decoration: none; }
.brand-icon { display: inline-block; transform: rotate(-10deg); }
.topbar nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar nav a:not(.btn) { color: var(--ink); font-weight: 500; font-size: .95rem; }
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px 40px; }
.container-wide { max-width: 1320px; }
.footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 30px 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer; font: 600 .95rem/1 'Poppins', sans-serif;
  background: var(--brand); color: #fff; padding: 12px 20px; border-radius: 999px; transition: background .15s, transform .15s, box-shadow .15s; text-decoration: none !important; }
.btn:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgba(112, 72, 232, .6); }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-lg { padding: 15px 28px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; color: var(--brand); box-shadow: inset 0 0 0 1.5px #d9cff5; }
.btn-ghost:hover { background: #f3f0ff; box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 2px 4px; color: var(--brand); font: inherit; font-size: .85rem; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--no); }

/* forms */
.form label, .designer label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 14px; }
.field-label { font-weight: 500; font-size: .9rem; margin: 4px 0 8px; }
input:not([type=radio]):not([type=checkbox]):not([type=color]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 11px 13px; font: inherit; font-size: .95rem; color: var(--ink);
  background: #fff; border: 1.5px solid #ddd5ec; border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(112, 72, 232, .15); }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: .93rem; }
.flash-success { background: #ebfbee; color: #2b8a3e; border: 1px solid #b2f2bb; }
.flash-error { background: #fff5f5; color: #c92a2a; border: 1px solid #ffc9c9; }
.flash-info { background: #f3f0ff; color: #5f3dc4; border: 1px solid #d0bfff; }

.auth-box { max-width: 420px; margin: 40px auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 32px; }
.auth-box h1 { margin-bottom: 20px; text-align: center; }

/* landing */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 50px; align-items: center; max-width: 1150px; margin: 0 auto; padding: 60px 24px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; margin-bottom: 18px; }
.hero h1 em { font-family: 'Pacifico', cursive; font-style: normal; color: var(--brand); }
.hero p { font-size: 1.1rem; color: #5a5270; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.features li { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: .94rem; }
.features strong { display: block; }
.hero-card { transform: rotate(2deg); }

/* dashboard */
.empty { text-align: center; padding: 60px 20px; background: #fff; border: 1px dashed #d9cff5; border-radius: 18px; }
.empty-icon { font-size: 3rem; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.event-tile { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: inherit; transition: transform .2s, box-shadow .2s; }
.event-tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: 0 14px 30px -14px rgba(60, 30, 120, .35); }
.event-tile.is-past { opacity: .7; }
.event-tile-art { position: relative; height: 130px; display: grid; place-items: center; }
.mini-graphic { width: 90px; height: 90px; }
.mini-graphic svg, .mini-graphic img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.badge { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: .72rem; padding: 3px 9px; border-radius: 999px; }
.event-tile-body { padding: 14px 16px 16px; }
.event-tile-body h3 { margin: 0 0 4px; font-size: 1.05rem; }
.event-tile-body p { margin: 0; font-size: .85rem; }
.tile-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.s-yes { color: var(--yes) !important; } .s-maybe { color: var(--maybe) !important; } .s-no { color: var(--no) !important; }

/* designer */
.designer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 480px); gap: 28px; align-items: start; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .82rem; margin-right: 6px; }
.designer-preview .preview-sticky { position: sticky; top: 86px; }
.preview-label { text-align: center; font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.envelope-chip { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; font-size: .85rem; color: var(--muted); }
.env-swatch { width: 28px; height: 18px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.designer-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); }

.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.theme-swatch { position: relative; height: 64px; border-radius: 12px; display: grid !important; place-items: center; cursor: pointer; margin: 0 !important; font-size: 1rem !important; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .15s; text-align: center; padding: 4px; }
.theme-swatch:hover { transform: translateY(-2px); }
.theme-swatch input, .graphic-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-swatch:has(input:checked), .graphic-option:has(input:checked) .graphic-thumb { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--brand); }
.graphic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; margin-bottom: 16px; }
.graphic-option { margin: 0 !important; cursor: pointer; position: relative; }
.graphic-thumb { display: grid; place-items: center; aspect-ratio: 1; border-radius: 12px; padding: 6px; background: linear-gradient(135deg, var(--bg1), var(--bg2)); color: var(--text); font-size: 1.3rem; line-height: 1.1; text-align: center; transition: transform .15s; overflow: hidden; }
.graphic-thumb small { display: block; font-size: .65rem; }
.graphic-thumb svg { width: 100%; height: 100%; }
.graphic-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.graphic-option:hover .graphic-thumb { transform: translateY(-2px); }
.color-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.color-field { display: flex !important; flex-direction: column; align-items: center; gap: 4px; font-size: .75rem !important; text-align: center; margin: 0 !important; }
.color-field input { width: 44px; height: 44px; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.color-field input::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input::-webkit-color-swatch { border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #ddd5ec; }
.color-field input::-moz-color-swatch { border: 2px solid #fff; border-radius: 50%; }

/* event view */
.stats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--muted); }
.stat-hl { background: var(--brand); border-color: var(--brand); color: #fff; }
.stat-hl span { color: rgba(255,255,255,.85); }
.callout { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: #fff9db; border: 1px solid #ffe066; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 12px; border-radius: 999px; background: #f3f0ff; color: var(--brand-dark); font-size: .8rem; }
.chip.active { background: var(--brand); color: #fff; }
.chip:hover { text-decoration: none; }
.table-wrap { overflow-x: auto; }
table.guests { width: 100%; border-collapse: collapse; font-size: .9rem; }
.guests th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.guests td { padding: 12px 10px; border-bottom: 1px solid #f1edf7; vertical-align: top; }
.guests .msg { max-width: 280px; color: #4a4260; }
.guests .diet { color: #a85d00; margin-bottom: 4px; }
.guests .actions { white-space: nowrap; text-align: right; }
.guests .actions form { display: inline; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pill-yes { background: #ebfbee; color: var(--yes); } .pill-no { background: #fff5f5; color: var(--no); }
.pill-maybe { background: #fff4e6; color: var(--maybe); } .pill-pending { background: #f1f3f5; color: #868e96; }
.diet-list { padding-left: 18px; margin: 0; font-size: .9rem; }
.diet-list li { margin-bottom: 6px; }
.danger-zone { text-align: center; padding: 12px; }

/* outbox */
.outbox { display: grid; grid-template-columns: 320px 1fr; gap: 18px; min-height: 70vh; }
.outbox-list { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 80vh; }
.outbox-list li a { display: flex; flex-direction: column; padding: 12px 14px; border-bottom: 1px solid #f1edf7; color: inherit; }
.outbox-list li a:hover { background: #faf8fe; text-decoration: none; }
.outbox-list li.active a { background: #f3f0ff; }
.outbox-view { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.outbox-meta { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.outbox-view iframe { flex: 1; width: 100%; min-height: 600px; border: 0; }

/* responsive */
@media (max-width: 1000px) {
  .designer, .two-col, .hero { grid-template-columns: minmax(0, 1fr); }
  .designer-preview { order: -1; }
  .designer-preview .preview-sticky { position: static; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .outbox { grid-template-columns: 1fr; }
  .hero-card { transform: none; }
}
@media (max-width: 600px) {
  .topbar { padding: 12px 16px; }
  .container { padding: 20px 16px 30px; }
  .row2, .row3 { grid-template-columns: 1fr; gap: 0; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .color-row { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .guests .actions { white-space: normal; }
}

/* mail queue */
.callout-queue { background: #f3f0ff; border-color: #d0bfff; }
.queued { color: var(--brand); }
