:root {
  --ie-bg: #f6f1ea;
  --ie-panel: #fffdf9;
  --ie-ink: #2a2420;
  --ie-muted: #7a6f66;
  --ie-line: #e8ddd1;
  --ie-accent: #c45c6a;
  --ie-accent-deep: #9e3f4d;
  --ie-soft: #f0e4d8;
  --ie-nav: #221e1b;
  --ie-radius: 14px;
  --ie-shadow: 0 18px 40px rgba(52, 36, 28, 0.08);
  --ie-font: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.ie-body {
  font-family: var(--ie-font);
  color: var(--ie-ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #f8d9cf 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #e7efe4 0%, transparent 50%),
    var(--ie-bg);
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.ie-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1.1rem;
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ie-line);
}
.ie-brand {
  font-family: "Dancing Script", cursive;
  font-size: 1.45rem; font-weight: 700; color: var(--ie-accent-deep);
  white-space: nowrap;
}
.ie-topbar__meta { display: flex; gap: .75rem; align-items: center; flex: 1; min-width: 0; }
.ie-status {
  font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .28rem .55rem; border-radius: 999px; background: #efe4d8; color: #6d4a3a;
}
.ie-save-hint { color: var(--ie-muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ie-topbar__actions { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }

.ie-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: .55rem 1rem; font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.ie-btn:hover { transform: translateY(-1px); }
.ie-btn--primary { background: var(--ie-accent); color: #fff; }
.ie-btn--primary:hover { background: var(--ie-accent-deep); }
.ie-btn--soft { background: var(--ie-soft); color: var(--ie-ink); }
.ie-btn--ghost { background: transparent; border-color: var(--ie-line); }
.ie-btn--danger { background: #f8e6e6; color: #9b2c2c; }
.ie-btn--file { position: relative; overflow: hidden; cursor: pointer; }
.ie-btn--file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.ie-shell {
  display: grid;
  grid-template-columns: 200px minmax(320px, 1fr) minmax(320px, 420px);
  min-height: calc(100vh - 58px);
}

.ie-nav {
  background: var(--ie-nav);
  color: #f7efe7;
  padding: 1rem .7rem;
  display: flex; flex-direction: column; gap: .25rem;
  overflow: auto;
}
.ie-nav button {
  appearance: none; border: 0; background: transparent; color: inherit;
  text-align: left; padding: .65rem .75rem; border-radius: 10px;
  cursor: pointer; font-size: .88rem; opacity: .78;
}
.ie-nav button:hover { background: rgba(255,255,255,.06); opacity: 1; }
.ie-nav button.is-active { background: rgba(196, 92, 106, .28); opacity: 1; font-weight: 600; }

.ie-editor {
  padding: 1.15rem 1.25rem 2.5rem;
  overflow: auto;
  background: linear-gradient(180deg, rgba(255,253,249,.55), transparent 180px);
}
.ie-panel { display: none; animation: ieIn .25s ease; }
.ie-panel.is-active { display: block; }
@keyframes ieIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ie-panel__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.ie-panel__head h2 { margin: 0 0 .25rem; font-size: 1.35rem; }
.ie-panel__head p { margin: 0; color: var(--ie-muted); }

.ie-form label {
  display: flex; flex-direction: column; gap: .35rem;
  margin-bottom: .85rem; font-size: .86rem; font-weight: 600; color: #4d433c;
}
.ie-form input, .ie-form select, .ie-form textarea {
  border: 1px solid var(--ie-line); border-radius: 12px;
  padding: .7rem .85rem; background: #fff; font-weight: 500;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.ie-form input:focus, .ie-form select:focus, .ie-form textarea:focus {
  border-color: #d9a3ab; box-shadow: 0 0 0 3px rgba(196, 92, 106, .12);
}
.ie-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .85rem; }
.ie-hint { color: var(--ie-muted); font-size: .85rem; }
.ie-suggest-bar {
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  margin: 0 0 1rem; padding: .65rem; background: #f7f3ee; border-radius: 12px;
}
.ie-suggest-bar select {
  border: 1px solid #e4ddd4; border-radius: 8px; padding: .4rem .55rem; background: #fff;
}
.ie-stat {
  margin: 1rem 0; padding: .85rem 1rem; border-radius: 12px;
  background: #fff; border: 1px dashed var(--ie-line);
}

.ie-switch {
  display: inline-flex !important; flex-direction: row !important; align-items: center; gap: .55rem;
  font-size: .82rem !important; font-weight: 600; cursor: pointer;
}
.ie-switch input { display: none; }
.ie-switch span {
  width: 40px; height: 22px; border-radius: 999px; background: #d8cfc4; position: relative;
  transition: background .2s ease;
}
.ie-switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .2s ease;
}
.ie-switch input:checked + span { background: var(--ie-accent); }
.ie-switch input:checked + span::after { transform: translateX(18px); }
.ie-check {
  display: flex !important; flex-direction: row !important; align-items: center; gap: .5rem;
  font-weight: 500 !important;
}
.ie-check input { width: auto; }

.ie-subcard {
  margin: 1rem 0; padding: 1rem; border-radius: var(--ie-radius);
  background: var(--ie-panel); border: 1px solid var(--ie-line); box-shadow: var(--ie-shadow);
}
.ie-subcard__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }

.ie-upload {
  display: grid; gap: 1rem; justify-items: start;
  padding: 1rem; border-radius: var(--ie-radius); border: 1px dashed #d4b8a8; background: #fff;
}
.ie-upload__preview {
  width: 100%; min-height: 180px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, #f0e4d8, #f8d9cf); display: grid; place-items: center;
  color: var(--ie-muted);
}
.ie-upload__preview img { width: 100%; height: 220px; object-fit: cover; display: block; }

.ie-album { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .65rem; margin-bottom: 1rem; }
.ie-album__item { position: relative; margin: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: #eee; }
.ie-album__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ie-album__item button {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
}

.ie-repeat {
  display: grid; grid-template-columns: 90px 1fr 1.2fr 36px; gap: .45rem; margin-bottom: .55rem; align-items: center;
}
.ie-icon-del {
  width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f3e7e7; color: #9b2c2c; cursor: pointer;
}
.ie-qr-row { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.ie-qr-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--ie-line); }

.ie-list { display: grid; gap: .45rem; margin-top: 1rem; }
.ie-list__row {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .7rem .85rem; border-radius: 10px; background: #fff; border: 1px solid var(--ie-line);
}

.ie-preview-pane {
  border-left: 1px solid var(--ie-line);
  background:
    linear-gradient(180deg, #ebe4db, #e3d8cb),
    repeating-linear-gradient(90deg, transparent, transparent 11px, rgba(0,0,0,.03) 11px, rgba(0,0,0,.03) 12px);
  padding: .85rem;
  display: flex; flex-direction: column; gap: .65rem;
  position: sticky; top: 58px; height: calc(100vh - 58px);
}
.ie-preview-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  color: #5d5046; font-size: .82rem; font-weight: 600;
}
.ie-preview-toolbar > div { display: flex; gap: .3rem; }
.ie-preview-toolbar button {
  border: 1px solid #d2c4b5; background: rgba(255,255,255,.55); border-radius: 999px;
  padding: .3rem .65rem; cursor: pointer; font-size: .75rem;
}
.ie-preview-toolbar button.is-active { background: #fff; border-color: #b08978; }
.ie-preview-close { display: none; width: 32px; height: 32px; border-radius: 50%; }

.ie-preview-frame {
  flex: 1; overflow: auto; margin: 0 auto; width: 100%;
  border-radius: 28px; background: #1c1917; padding: 10px;
  box-shadow: 0 25px 50px rgba(40, 28, 20, .25);
  transition: max-width .25s ease;
}
.ie-preview-frame.is-mobile { max-width: 360px; }
.ie-preview-frame.is-desktop { max-width: 100%; border-radius: 16px; }

/* Live preview invitation look */
.ipv {
  background: #fffdf9; color: #2b2420; min-height: 100%;
  border-radius: 20px; overflow: hidden;
}
.ipv-cover {
  position: relative; min-height: 280px; padding: 2.5rem 1.25rem 2rem;
  display: grid; align-content: end; color: #fff;
  background:
    linear-gradient(160deg, #d9a3ab, #9e3f4d 70%),
    center/cover no-repeat;
  background-blend-mode: multiply;
}
.ipv-cover__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,12,10,.15), rgba(20,12,10,.55));
}
.ipv-cover > *:not(.ipv-cover__veil) { position: relative; z-index: 1; }
.ipv-kicker { margin: 0; text-transform: uppercase; letter-spacing: .18em; font-size: .7rem; opacity: .85; }
.ipv-names { margin: .35rem 0; font-size: 2.2rem; line-height: 1.1; font-weight: 700; }
.ipv-names em { display: block; font-style: normal; font-size: 1.1rem; opacity: .85; margin: .15rem 0; }
.ipv-date { margin: 0; opacity: .9; }
.ipv-sec { padding: 1.25rem 1.15rem; border-bottom: 1px solid #efe5da; }
.ipv-sec h2, .ipv-sec h3 { margin: 0 0 .55rem; font-size: 1.15rem; }
.ipv-msg { margin: 0; line-height: 1.65; color: #574a41; white-space: pre-wrap; }
.ipv-parents { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.ipv-parents small { display: block; color: #8a7b70; margin-bottom: .2rem; }
.ipv-muted { color: #8a7b70; }
.ipv-album { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.ipv-album img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.ipv-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.ipv-swatches { display: flex; gap: .4rem; margin-top: .55rem; }
.ipv-swatches span { width: 22px; height: 22px; border-radius: 50%; border: 1px solid #ddd; }
.ipv-bank { margin-bottom: .65rem; padding: .7rem; border-radius: 10px; background: #f8f1ea; }
.ipv-cta { text-align: center; }
.ipv-pill {
  display: inline-block; margin-top: .5rem; padding: .45rem .9rem; border-radius: 999px;
  background: var(--ipv-accent, #c45c6a); color: #fff; font-size: .85rem; font-weight: 600;
}
.ipv-foot { padding: 1.35rem 1.15rem 1.8rem; text-align: center; color: #6d5d52; font-style: italic; }

/* Index page */
.ie-index { max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.ie-index__head h1 { margin: 0 0 .35rem; font-size: 2rem; }
.ie-index__head p { margin: 0 0 1.5rem; color: var(--ie-muted); }
.ie-index__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.ie-card {
  background: #fff; border: 1px solid var(--ie-line); border-radius: 18px; overflow: hidden;
  box-shadow: var(--ie-shadow);
}
.ie-card__cover {
  height: 150px; background: linear-gradient(135deg, #f0e4d8, #d9a3ab) center/cover;
  position: relative;
}
.ie-card__badge {
  position: absolute; top: 10px; left: 10px; font-size: .72rem; font-weight: 700;
  padding: .25rem .55rem; border-radius: 999px; background: rgba(255,255,255,.9); color: #6d4a3a;
}
.ie-card__badge.is-live { background: #e8f5e9; color: #2e7d32; }
.ie-card__body { padding: 1rem; }
.ie-card__body h2 { margin: 0 0 .25rem; font-size: 1.1rem; }
.ie-card__body p { margin: 0 0 .85rem; color: var(--ie-muted); font-size: .9rem; }
.ie-card__stats { margin-top: -.4rem !important; font-size: .82rem !important; color: var(--ie-accent-deep) !important; }
.ie-card__actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.ie-empty {
  grid-column: 1 / -1; text-align: center; padding: 3rem 1.5rem;
  border: 1px dashed var(--ie-line); border-radius: 18px; background: rgba(255,255,255,.65);
}
.ie-alert {
  margin-bottom: 1rem; padding: .75rem 1rem; border-radius: 12px;
  background: #e8f5e9; color: #1b5e20;
}

.ie-dash {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: .55rem;
  margin-bottom: 1rem;
}
.ie-dash > div {
  background: #fff; border: 1px solid var(--ie-line); border-radius: 12px;
  padding: .7rem .55rem; text-align: center;
}
.ie-dash strong { display: block; font-size: 1.25rem; color: var(--ie-accent-deep); }
.ie-dash span { font-size: .72rem; color: var(--ie-muted); }
.ie-share { display: flex; flex-wrap: wrap; gap: .45rem; }
.ie-qr-box { margin-top: .75rem; text-align: center; }
.ie-guest-table { display: grid; gap: .45rem; max-height: 360px; overflow: auto; }
.ie-guest-row {
  display: flex; justify-content: space-between; gap: .75rem; align-items: center;
  padding: .7rem .8rem; border-radius: 12px; background: #fff; border: 1px solid var(--ie-line);
}
.ie-guest-row small { display: block; color: var(--ie-muted); margin-top: .15rem; }
.ie-guest-actions { display: flex; gap: .35rem; align-items: center; flex-shrink: 0; }
.ie-presets { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Modals */
.ie-modal[hidden] { display: none !important; }
.ie-modal {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem;
}
.ie-modal__backdrop { position: absolute; inset: 0; background: rgba(28, 18, 14, .45); backdrop-filter: blur(3px); }
.ie-modal__panel {
  position: relative; z-index: 1; width: min(520px, 96vw); max-height: min(90vh, 720px);
  overflow: auto; background: #fffdf9; border-radius: 18px; border: 1px solid #eadfd0;
  box-shadow: 0 30px 70px rgba(40, 24, 18, .25);
}
.ie-modal__panel--auth { width: min(420px, 96vw); }
.ie-modal__head {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  padding: 1.15rem 1.2rem .5rem; border-bottom: 1px solid #efe5da;
}
.ie-modal__head h2 { margin: 0 0 .25rem; font-size: 1.25rem; }
.ie-modal__head p { margin: 0; color: var(--ie-muted); font-size: .9rem; }
.ie-modal__progress { font-size: .85rem !important; }
.ie-modal__x {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f3ebe3; cursor: pointer; font-size: 1.2rem;
}
.ie-modal__body { padding: 1rem 1.2rem; }
.ie-modal__foot {
  display: flex; justify-content: space-between; gap: .75rem; padding: 0.85rem 1.2rem 1.15rem;
  border-top: 1px solid #efe5da;
}
.ie-btn--publish { background: #e8b84a; color: #3a2a10; font-weight: 700; }
.ie-btn--publish:hover { background: #d9a734; }
.ie-check-group { margin-bottom: 1rem; }
.ie-check-group h3 {
  margin: 0 0 .45rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ie-muted);
}
.ie-check-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.ie-check-group li {
  display: flex; align-items: center; gap: .55rem; padding: .55rem .65rem;
  border-radius: 10px; background: #fff; border: 1px solid var(--ie-line); font-size: .92rem;
}
.ie-check-group li.is-ok { border-color: #c8e6c9; background: #f4faf4; }
.ie-check-group li em { color: #b45309; font-style: normal; font-size: .8rem; margin-left: auto; }
.ie-check-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid #cbb8a8; flex-shrink: 0;
}
.ie-check-group li.is-ok .ie-check-dot { background: #43a047; border-color: #43a047; }
.ie-modal__info {
  margin-top: .5rem; padding: .75rem .85rem; border-radius: 12px;
  background: #eef6ff; color: #1e4b7a; font-size: .88rem; line-height: 1.45;
}
.ie-auth-google {
  display: flex; justify-content: center; align-items: center; gap: .5rem;
  width: 100%; padding: .75rem 1rem; border-radius: 12px; border: 1px solid #ddd;
  background: #fff; font-weight: 600; margin-bottom: .75rem;
}
.ie-auth-or { text-align: center; color: var(--ie-muted); font-size: .8rem; margin: .5rem 0 .85rem; position: relative; }
.ie-auth-or span { background: #fffdf9; padding: 0 .5rem; position: relative; z-index: 1; }
.ie-auth-or::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #eadfd0;
}
.ie-auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin-bottom: .85rem; }
.ie-auth-tabs button {
  border: 1px solid var(--ie-line); background: #fff; border-radius: 999px; padding: .5rem; cursor: pointer; font-weight: 600;
}
.ie-auth-tabs button.is-active { background: var(--ie-accent); color: #fff; border-color: var(--ie-accent); }
.ie-auth-form label { display: grid; gap: .3rem; margin-bottom: .7rem; font-size: .86rem; font-weight: 600; }
.ie-auth-form input {
  border: 1px solid var(--ie-line); border-radius: 12px; padding: .7rem .85rem; font: inherit;
}
.ie-auth-msg { text-align: center; font-size: .88rem; margin: .55rem 0 0; }
.ie-auth-benefits { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .35rem; font-size: .85rem; color: #5a4c42; }
.ie-auth-benefits li::before { content: "✓ "; color: var(--ie-accent); font-weight: 700; }

@media (max-width: 1100px) {
  .ie-shell { grid-template-columns: 170px 1fr; }
  .ie-preview-pane {
    position: fixed; inset: 0; z-index: 50; height: 100%; top: 0;
    transform: translateY(110%); transition: transform .3s ease;
  }
  .ie-preview-pane.is-open { transform: none; }
  .ie-preview-close { display: inline-grid; place-items: center; border: 0; background: #fff; cursor: pointer; }
}
@media (max-width: 760px) {
  .ie-shell { grid-template-columns: 1fr; }
  .ie-nav {
    flex-direction: row; overflow-x: auto; padding: .55rem;
    position: sticky; top: 58px; z-index: 20;
  }
  .ie-nav button { white-space: nowrap; flex: 0 0 auto; }
  .ie-grid-2 { grid-template-columns: 1fr; }
  .ie-repeat { grid-template-columns: 1fr 1fr; }
  .ie-repeat .ie-icon-del { grid-column: 2; justify-self: end; }
  .ie-topbar { flex-wrap: wrap; }
  .ie-topbar__meta { order: 3; width: 100%; }
  .ie-dash { grid-template-columns: repeat(2, 1fr); }
}
