:root {
  --bg: #f4efe5;
  --surface: rgba(255, 252, 246, 0.82);
  --card: #fffaf1;
  --card-strong: #ffffff;
  --ink: #17130d;
  --ink-soft: #302719;
  --muted: #817463;
  --line: rgba(45, 35, 21, 0.12);
  --line-strong: rgba(45, 35, 21, 0.2);
  --gold: #c9a45d;
  --gold-strong: #a87c32;
  --gold-soft: #f6e7c6;
  --green: #067647;
  --green-soft: #dcfae6;
  --yellow: #92400e;
  --yellow-soft: #fff3c7;
  --red: #b42318;
  --red-soft: #fee4e2;
  --shadow-sm: 0 8px 24px rgba(33, 24, 13, 0.07);
  --shadow-md: 0 18px 55px rgba(33, 24, 13, 0.12);
  --shadow-dark: 0 24px 75px rgba(0, 0, 0, 0.28);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
  background:
    radial-gradient(
      circle at top left,
      rgba(201, 164, 93, 0.24),
      transparent 34rem
    ),
    radial-gradient(
      circle at 85% 12%,
      rgba(23, 19, 13, 0.08),
      transparent 24rem
    ),
    linear-gradient(180deg, #f7f0e3 0%, #efe7d8 100%);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(201, 164, 93, 0.34);
  outline-offset: 2px;
}

.page-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 19, 13, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 19, 13, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 74%);
}

.app {
  width: min(100%, 1160px);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.72);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 34%),
    linear-gradient(135deg, #17130d, #3b2d17 58%, #c9a45d);
  color: #fff7e8;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 28px rgba(31, 21, 10, 0.22);
}

.brand-title {
  min-width: 0;
}

.brand-title strong,
.brand-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title strong {
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.brand-title span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.topbar-action {
  min-height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgba(168, 124, 50, 0.22);
  border-radius: 999px;
  padding: 0 14px;
  background: #20170c;
  color: #fff4df;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(
      circle at 78% 20%,
      rgba(231, 191, 112, 0.32),
      transparent 20rem
    ),
    radial-gradient(
      circle at 0% 100%,
      rgba(201, 164, 93, 0.18),
      transparent 23rem
    ),
    linear-gradient(135deg, #15110b 0%, #21170d 48%, #080704 100%);
  color: #fff5e3;
  box-shadow: var(--shadow-md);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(246, 231, 198, 0.16);
  border-radius: 22px;
  pointer-events: none;
}

.hero-ornament {
  position: absolute;
  width: 460px;
  height: 460px;
  right: -170px;
  top: -210px;
  border: 1px solid rgba(246, 231, 198, 0.12);
  border-radius: 50%;
}

.hero-ornament::before,
.hero-ornament::after {
  content: "";
  position: absolute;
  inset: 44px;
  border: 1px solid rgba(246, 231, 198, 0.09);
  border-radius: 50%;
}

.hero-ornament::after {
  inset: 88px;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: end;
  padding: 30px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid rgba(246, 231, 198, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 245, 227, 0.84);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(201, 164, 93, 0.88);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 14px;
  color: #fff9ef;
  font-size: clamp(32px, 4.2vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.hero-desc {
  max-width: 690px;
  margin-bottom: 0;
  color: rgba(255, 245, 227, 0.72);
  font-size: 15px;
  line-height: 1.7;
}

.event-card {
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr;
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid rgba(246, 231, 198, 0.14);
  border-radius: 20px;
  background: rgba(246, 231, 198, 0.13);
}

.event-card > div {
  min-width: 0;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.06);
}

.event-card span,
.stat span {
  display: block;
  color: rgba(255, 245, 227, 0.62);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.event-card strong {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: #fff6e7;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

button,
.button {
  min-height: 44px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

button:hover,
.button:hover {
  border-color: rgba(168, 124, 50, 0.32);
  box-shadow: 0 8px 22px rgba(33, 24, 13, 0.08);
}

button:active {
  transform: translateY(1px);
}

.btn-ghost-light {
  border-color: rgba(246, 231, 198, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: #fff4df;
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-solid-light {
  border-color: rgba(255, 255, 255, 0.2);
  background: #fff1d1;
  color: #25180b;
}

.btn-primary {
  border-color: #20170c;
  background: #20170c;
  color: #fff4df;
}

.btn-primary:hover {
  border-color: #2d2112;
  background: #2d2112;
}

button:disabled,
.disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none !important;
}

.stats {
  display: grid;
  gap: 10px;
}

.stat {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(246, 231, 198, 0.16);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.075);
  backdrop-filter: blur(14px);
}

.stat strong {
  display: block;
  margin-top: 10px;
  color: #fff9ef;
  font-size: 38px;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.panel {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius-xl);
  background: rgba(255, 252, 246, 0.78);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
}

.panel-kicker {
  margin-bottom: 4px;
  color: var(--gold-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel h2 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.template-status {
  flex: 0 0 auto;
  border: 1px solid rgba(168, 124, 50, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(246, 231, 198, 0.52);
  color: #6d4d19;
  font-size: 12px;
  font-weight: 850;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 210px 210px;
  gap: 10px;
  padding: 0 20px 16px;
}

.field,
.select-wrap {
  position: relative;
  min-width: 0;
}

.field-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-52%);
  color: var(--muted);
  font-size: 19px;
  pointer-events: none;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 48px;
  border-radius: 999px;
  font-size: 13px;
}

input {
  padding: 0 14px 0 43px;
}

select {
  padding: 0 42px 0 15px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 17px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-68%) rotate(45deg);
  pointer-events: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(168, 124, 50, 0.42);
  box-shadow: 0 0 0 4px rgba(201, 164, 93, 0.12);
}

.list-wrap {
  padding: 0 20px 20px;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.list {
  display: grid;
  gap: 10px;
}

.guest-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(45, 35, 21, 0.09);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(201, 164, 93, 0.12), transparent 13rem),
    var(--card-strong);
  padding: 16px;
  box-shadow: 0 6px 18px rgba(33, 24, 13, 0.045);
}

.guest-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #e3c477, #8d6423);
}

.guest-main,
.guest-topline,
.guest-topline > div {
  min-width: 0;
}

.guest-name {
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.guest-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid rgba(45, 35, 21, 0.06);
  border-radius: 999px;
  padding: 6px 10px;
  background: #f7f1e6;
  color: #5a4b36;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.badge.sent {
  border-color: rgba(6, 118, 71, 0.12);
  background: var(--green-soft);
  color: var(--green);
}

.badge.unsent {
  border-color: rgba(146, 64, 14, 0.12);
  background: var(--yellow-soft);
  color: var(--yellow);
}

.badge.error {
  border-color: rgba(180, 35, 24, 0.12);
  background: var(--red-soft);
  color: var(--red);
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 8px;
}

.actions button {
  min-height: 42px;
  padding: 0 14px;
  font-size: 12.5px;
  white-space: nowrap;
}

.empty {
  border: 1px dashed rgba(45, 35, 21, 0.18);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 15px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(10, 7, 4, 0.58);
  backdrop-filter: blur(8px);
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(88vh, 780px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(246, 231, 198, 0.18);
  border-radius: 26px;
  background: #fffaf1;
  box-shadow: var(--shadow-dark);
}

.modal-card-template {
  width: min(880px, 100%);
}

.modal-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(
      circle at top right,
      rgba(201, 164, 93, 0.18),
      transparent 18rem
    ),
    #fffaf1;
}

.modal-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.modal-title strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
}

.modal-name {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
}

.modal-close {
  width: 40px !important;
  height: 40px;
  min-height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  padding: 0 !important;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

pre {
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
  font-size: 14px;
  line-height: 1.68;
  color: var(--ink-soft);
  background: #fffdf8;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #fffaf1;
}

.template-editor {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #fffdf8;
}

.placeholder-box {
  margin-bottom: 14px;
  border: 1px solid rgba(201, 164, 93, 0.2);
  border-radius: 20px;
  padding: 14px;
  background: rgba(246, 231, 198, 0.34);
}

.placeholder-box strong {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: #6b4a17;
}

.placeholder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.placeholder-list button {
  min-height: 34px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.72);
  color: #5d3f13;
  font-size: 12px;
}

.template-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

textarea {
  min-height: 430px;
  resize: vertical;
  border-radius: 20px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 150;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  width: calc(100% - 28px);
  max-width: 360px;
  border-radius: 999px;
  background: #17130d;
  color: #fff4df;
  padding: 12px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-dark);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media screen and (max-width: 980px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .field {
    grid-column: 1 / -1;
  }

  .guest-card {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .actions button {
    width: 100%;
  }
}

@media screen and (max-width: 700px) {
  .app {
    width: 100%;
    max-width: 430px;
    padding: 10px;
  }

  .topbar {
    align-items: center;
    border-radius: 24px;
  }

  .topbar-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 11px;
    font-size: 11px;
    white-space: nowrap;
  }

  .hero {
    border-radius: 28px;
  }

  .hero::before {
    inset: 10px;
    border-radius: 20px;
  }

  .hero-inner {
    padding: 20px;
    gap: 18px;
  }

  .eyebrow {
    margin-bottom: 12px;
    font-size: 10.5px;
  }

  h1 {
    font-size: clamp(31px, 9vw, 40px);
    line-height: 1.06;
  }

  .hero-desc {
    font-size: 13px;
    line-height: 1.58;
  }

  .event-card {
    grid-template-columns: 1fr;
  }

  .event-card strong {
    white-space: normal;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions button,
  .modal-foot button,
  .toolbar input,
  .toolbar select {
    width: 100%;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
  }

  .stat strong {
    margin-top: 0;
    font-size: 28px;
  }

  .panel {
    margin-top: 10px;
    border-radius: 28px;
  }

  .panel-head {
    display: grid;
    gap: 10px;
    padding: 18px 14px 12px;
  }

  .template-status {
    width: fit-content;
    max-width: 100%;
  }

  .toolbar {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }

  .list-wrap {
    padding: 0 14px 14px;
  }

  .list-head {
    display: grid;
    gap: 4px;
  }

  .guest-card {
    padding: 14px;
    border-radius: 20px;
  }

  .guest-name {
    font-size: 14px;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
  }

  .modal-foot {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px 14px 14px;
  }

  pre {
    padding: 14px;
    font-size: 12.8px;
  }

  .template-editor {
    padding: 14px;
  }

  textarea {
    min-height: 360px;
    font-size: 13px;
  }
}

@media screen and (max-width: 390px) {
  .app {
    padding: 8px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .brand-title strong {
    font-size: 13px;
  }

  .brand-title span {
    font-size: 11px;
  }

  .hero-inner {
    padding: 18px;
  }

  .actions {
    grid-template-columns: 1fr;
  }
}

html.force-mobile .app,
body.force-mobile .app {
  width: 100% !important;
  max-width: 430px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
