:root {
  /* Burgundy, ivory, olive and gold */
  --bg: #f4ece0;
  --panel: #fbf7f0;
  --raise: #f1e8da;
  --raise-2: #e8dbc7;
  --line: rgba(92, 27, 36, 0.1);
  --line-2: rgba(92, 27, 36, 0.22);
  --text: #2e1d1a;
  --muted: #7a6052;
  --faint: #a8907f;
  --cream: #5c1b24;
  --wine: #5c1b24;
  --wine-2: #4a141c;
  --olive: #3f4a2f;
  --gold: #b8955a;
  --ivory: #f7efe2;
  --good: #5f7146;
  --warn: #b8873a;
  --bad: #a5352f;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --script: 'Pinyon Script', cursive;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --font: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
*:focus, *:focus-visible { outline: none; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; letter-spacing: -0.01em; line-height: 1.1; }
h2 { font-size: 16px; }
h3 { font-size: 13px; font-weight: 500; color: var(--muted); }
a { color: var(--wine); text-underline-offset: 3px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }

/* Buttons and inputs */
.btn {
  height: 36px; padding: 0 14px; border-radius: 6px; border: 0; background: var(--panel); color: var(--text);
  box-shadow: 0 0 0 1px var(--line); font-weight: 500; cursor: pointer; white-space: nowrap; user-select: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--raise-2); }
.btn:active { transform: scale(0.98); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.big { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.primary { background: var(--wine); color: var(--ivory); box-shadow: none; font-weight: 600; }
.btn.primary:hover { background: var(--wine-2); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--raise); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--raise); color: var(--text); }
.input, textarea.input, select.input {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: 6px; border: 0; background: #fffdf8;
  box-shadow: 0 0 0 1px var(--line); color: var(--text);
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--faint); }
.input:focus { box-shadow: 0 0 0 1px var(--line-2); }
.input.err { box-shadow: 0 0 0 1px var(--bad); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { color: var(--muted); font-size: 12px; }
.field small { color: var(--faint); font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; margin-bottom: 12px; }
.check input { margin: 3px 0 0; accent-color: var(--cream); }
.check small { display: block; color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; background: var(--raise); border-radius: 8px; padding: 3px; gap: 2px; box-shadow: 0 0 0 1px var(--line); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.seg button.on { background: var(--raise-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }

/* Layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; min-height: 100dvh; }
.side { background: var(--wine); color: var(--ivory); border-right: 0; padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.side .couple { padding: 0 10px 18px; }
.side .couple b { display: block; font-family: var(--script); font-weight: 400; font-size: 30px; line-height: 1.15; color: #f7efe2; }
.side .couple span { color: #cbb592; font-size: 12px; letter-spacing: 0.04em; }
.side a.nav { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 6px; color: rgba(247, 239, 226, 0.72); text-decoration: none; font-weight: 500; }
.side a.nav:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.side a.nav.on { background: rgba(255, 255, 255, 0.12); color: #fff; }
.side a.nav.on svg { color: var(--gold); }
.side a.nav svg { flex: none; }
.side .sep { height: 1px; background: rgba(184, 149, 90, 0.35); margin: 10px 4px; }
.side .bottom { margin-top: auto; display: grid; gap: 2px; }
.main { min-width: 0; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--panel); border-radius: 12px; box-shadow: 0 0 0 1px var(--line); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 14px; font-family: var(--serif); font-size: 21px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border-radius: 12px; padding: 16px 18px; box-shadow: 0 0 0 1px var(--line); }
.stat b { display: block; font-family: var(--serif); font-size: 38px; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; }
.steps li a { color: var(--text); text-decoration: none; flex: 1; }
.steps li:hover { background: var(--raise); }
.tick { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--faint); flex: none; display: grid; place-items: center; }
.tick.done { background: var(--good); box-shadow: none; color: #fff; }
.steps li.done a { color: var(--muted); }

.event-sum { display: grid; gap: 10px; }
.event-sum .row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.event-sum .row:first-child { border-top: 0; }
.bar { height: 6px; border-radius: 3px; background: var(--raise-2); overflow: hidden; display: flex; grid-column: 1 / -1; }
.bar i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--c); }
.meals { color: var(--muted); font-size: 12px; grid-column: 1 / -1; }

/* Website editor */
.editor { display: grid; grid-template-columns: minmax(340px, 440px) 1fr; gap: 20px; align-items: start; }
.editor .form { display: grid; gap: 16px; }
.preview-wrap { position: sticky; top: 20px; height: calc(100vh - 40px); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-2); background: #fff; display: flex; flex-direction: column; }
.preview-top { height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--raise-2); color: var(--muted); font-size: 12px; }
.preview-top .url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-wrap iframe { border: 0; width: 100%; flex: 1; background: #fff; }
.preview-wrap.phone { width: 390px; justify-self: center; height: min(844px, calc(100vh - 40px)); }
.themes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.theme-pick { border: 0; border-radius: 10px; padding: 14px 8px 10px; cursor: pointer; text-align: center; box-shadow: 0 0 0 1px var(--line); }
.theme-pick .sample { display: block; font-size: 22px; line-height: 1.1; margin-bottom: 8px; color: #222; }
.theme-pick .lbl { display: block; font-size: 12px; color: #555; }
.theme-pick.on { box-shadow: 0 0 0 2px var(--wine); }
.photo-pick { display: flex; gap: 10px; align-items: center; }
.photo-pick img { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs .t { position: relative; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.thumbs .t button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 6px; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; display: grid; place-items: center; }
.list-edit { display: grid; gap: 8px; }
.list-edit .item { display: grid; gap: 6px; padding: 10px; border-radius: 8px; background: var(--raise); position: relative; }
.list-edit .item .icon-btn { position: absolute; top: 4px; right: 4px; }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: var(--bg); box-shadow: 0 -1px 0 var(--line); display: flex; gap: 8px; align-items: center; }
.save-bar .state { color: var(--muted); font-size: 13px; }
.link-row { display: flex; align-items: center; gap: 0; }
.link-row .pre { color: var(--faint); background: var(--raise); height: 38px; display: flex; align-items: center; padding: 0 2px 0 12px; border-radius: 8px 0 0 8px; box-shadow: 0 0 0 1px var(--line); white-space: nowrap; font-size: 13px; }
.link-row .input { border-radius: 0 8px 8px 0; }

/* Events */
.event-card .head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.event-card .head .input { font-weight: 600; font-size: 15px; max-width: 360px; }

/* Guests table */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .input { max-width: 260px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--panel); }
td .who { font-weight: 500; }
td .names { color: var(--muted); font-size: 13px; margin-top: 2px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.yes i { background: var(--good); }
.status.no i { background: var(--bad); }
.status.part i { background: var(--warn); }
.cat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.more { display: block; width: 100%; margin-top: 10px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(46, 29, 26, 0.45); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade 0.2s var(--ease-out); }
.modal { background: var(--panel); border-radius: 14px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 64px rgba(46,29,26,.25); width: min(640px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; animation: rise 0.25s var(--ease-out); }
.modal .m-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .m-body { padding: 20px; overflow-y: auto; }
.modal .m-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal .m-foot .left { margin-right: auto; }
.guest-edit { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.guest-edit label { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.guest-edit label input { accent-color: var(--cream); }
.rsvp-grid { width: 100%; border-collapse: collapse; margin-top: 4px; }
.rsvp-grid td, .rsvp-grid th { padding: 6px 4px; text-align: left; font-size: 13px; }
.rsvp-grid th { color: var(--muted); font-weight: 500; }
.rsvp-grid select { min-height: 32px; padding: 4px 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Invites */
.send-list { display: grid; gap: 10px; }
.send-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 10px; background: var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.send-row:hover { background: var(--raise); }
.send-row b { display: block; }
.send-row .meta { color: var(--muted); font-size: 13px; }
.send-row .nums { display: flex; gap: 18px; color: var(--muted); font-size: 13px; text-align: right; }
.send-row .nums b { color: var(--text); font-size: 15px; }
.mail-editor { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 20px; align-items: start; }
.mail-preview { border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-2); background: #fff; height: calc(100vh - 160px); position: sticky; top: 20px; }
.mail-preview iframe { width: 100%; height: 100%; border: 0; }

/* Sign in */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: min(400px, 100%); }
.auth h1 { margin-bottom: 8px; }
.auth p { color: var(--muted); margin: 0 0 20px; }
.auth .brand { font-family: var(--script); font-size: 34px; margin-bottom: 32px; color: var(--wine); }
.dev-link { margin-top: 16px; padding: 12px; border-radius: 8px; background: var(--raise); font-size: 13px; color: var(--muted); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; background: #2e1d1a; color: var(--ivory); padding: 10px 14px; border-radius: 10px; box-shadow: 0 12px 32px rgba(46,29,26,.3); font-size: 13px; max-width: calc(100vw - 32px); animation: rise 0.25s var(--ease-out); }
.toast.bad { color: #f2b8b0; }

/* Planner's weddings list */
.studio { min-height: 100vh; min-height: 100dvh; }
.studio-head { background: var(--wine); color: var(--ivory); display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 24px 12px; }
.studio-brand { font-family: var(--script); font-size: 34px; line-height: 1.1; }
.studio-head nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.studio-head nav a { color: rgba(247, 239, 226, 0.8); text-decoration: none; font-weight: 500; }
.studio-head nav a:hover, .studio-head nav a.on { color: #fff; }
.studio-head nav a.on { box-shadow: inset 0 -2px 0 var(--gold); padding-bottom: 2px; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: #2e1d1a; font-size: 11px; font-weight: 600; margin-left: 4px; }
.studio-main.wide { max-width: 1400px; }
.enq-detail { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; }
.enq-detail dt { color: var(--muted); font-size: 13px; }
.enq-detail dd { margin: 0; }
.studio-head .btn.ghost { color: rgba(247, 239, 226, 0.8); }
.studio-head .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.studio-main { max-width: 1040px; margin: 0 auto; }
.w-names { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.2; }
.past { margin-top: 20px; }
.past summary { cursor: pointer; color: var(--muted); font-weight: 500; padding: 8px 0; }
.past .card { margin-top: 8px; }
.all-weddings { display: flex; align-items: center; gap: 6px; color: #cbb592; text-decoration: none; font-size: 13px; font-weight: 500; padding: 0 10px 14px; }
.all-weddings:hover { color: #fff; }
.side-brand { font-family: var(--script); font-size: 24px; color: #cbb592; padding: 0 10px 10px; }

/* Landing */
.landing { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--wine); color: var(--ivory); }
.land { max-width: 640px; padding: 56px 24px; text-align: center; }
.land-brand { font-family: var(--script); font-size: clamp(52px, 10vw, 76px); color: #f7efe2; margin: 0; line-height: 1.1; }
.land .orn { display: block; margin: 18px auto 26px; color: var(--gold); }
.land h1 { font-family: 'Cinzel', var(--serif); font-weight: 400; font-size: clamp(18px, 3vw, 22px); line-height: 1.6; letter-spacing: 0.12em; text-transform: uppercase; color: #eadcc3; margin: 0 auto 28px; max-width: 30ch; text-wrap: balance; }
.land-list { list-style: none; padding: 0; margin: 0 auto 36px; display: grid; gap: 10px; font-family: var(--serif); font-size: 20px; color: #f1e6d4; max-width: 46ch; }
.land .btn.primary { background: #f7efe2; color: var(--wine); height: 50px; padding: 0 30px; font-family: 'Cinzel', var(--serif); letter-spacing: 0.14em; text-transform: uppercase; font-size: 13px; border-radius: 2px; }
.land .btn.primary:hover { background: #fff; }
.land-small { color: #cbb592; margin-top: 18px; }
.land-small a { color: #f7efe2; }

@media (max-width: 1100px) {
  .editor, .mail-editor, .grid2 { grid-template-columns: 1fr; }
  .preview-wrap, .mail-preview { position: static; height: 70vh; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  /* Phone: the menu wraps onto a few short rows instead of running off the screen. */
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px; padding: calc(12px + env(safe-area-inset-top)) 10px 10px; }
  .side .all-weddings { width: 100%; padding: 0 6px 4px; }
  .side .side-brand { width: 100%; padding: 0 6px 2px; }
  .side .couple { width: 100%; padding: 0 6px 8px; }
  .side .couple b { font-size: 26px; }
  .side .couple span, .side .sep { display: none; }
  .side .bottom { display: contents; }
  .side a.nav { height: 34px; padding: 0 10px; white-space: nowrap; font-size: 13px; }
  .side a.nav svg { display: none; }
  .main { padding: 20px 16px 48px; }
  .grid2, .row3 { grid-template-columns: 1fr; }
  table.list .hide-sm { display: none; }
  .guest-edit { grid-template-columns: 1fr 1fr; }
  .preview-wrap.phone { width: 100%; }
  .studio-head { padding-left: 16px; padding-right: 16px; }
  .studio-brand { font-size: 28px; }
  .studio-head { flex-wrap: wrap; gap: 6px; }
  .studio-head nav { gap: 12px; justify-content: flex-start; }
  .enq-detail { grid-template-columns: 1fr; gap: 2px; }
  .enq-detail dd { margin-bottom: 8px; }
}
}
@media (prefers-reduced-motion: reduce) { .modal, .modal-back, .toast { animation: none; } }
