:root {
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-800: #292524;
  --green-500: #22c55e;
  --green-400: #4ade80;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--stone-800);
  background: var(--stone-50);
  line-height: 1.5;
}

h1, h2, h3, h4, .brand, .guest-name, .total-number {
  font-family: "Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
}

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 11rem;
}

main.no-bottom { padding-bottom: 2rem; }

h1.page-title { font-size: 1.875rem; font-weight: 600; margin: 0 0 2.5rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2.5rem; }
.page-header h1.page-title { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.page-actions form { margin: 0; }
h2.section-title { font-size: 1.125rem; font-weight: 600; margin: 2rem 0 1rem; }

p { line-height: 1.5; margin: 1rem 0; }

.muted { color: var(--stone-500); font-size: .875rem; }
.italic { font-style: italic; }
.mb-0 { margin-bottom: 0; }
.mt-8 { margin-top: 2rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-10 { margin-bottom: 2.5rem; }
.space-y-2 > * + * { margin-top: .5rem; }

.back-link {
  display: block;
  margin-bottom: 2rem;
  color: var(--stone-600);
  font-size: .875rem;
  text-underline-offset: 2px;
}

/* Share page */
.share-eyebrow {
  margin: 0 0 .25rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--stone-500);
}
.share-title-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.share-title-row .guest-name { margin: 0; }
.pill {
  display: inline-block;
  padding: .2rem .7rem;
  border: 1px solid var(--stone-300);
  border-radius: 999px;
  background: var(--stone-100);
  color: var(--stone-600);
  font-size: .8125rem;
  white-space: nowrap;
}
.share-progress { margin-top: .75rem; }
.progress-track {
  margin-top: .375rem;
  height: 4px;
  border-radius: 999px;
  background: var(--stone-200);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--stone-600);
  transition: width .3s ease;
}
.chat-preview {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .5rem;
  font-size: .8125rem;
}
.chat-header-label { font-weight: 600; color: #128c7e; }
.chat-bubble {
  align-self: flex-end;
  background: #dcf8c6;
  border-radius: .75rem;
  border-bottom-right-radius: .25rem;
  padding: 1rem 1.25rem;
  max-width: 92%;
  box-shadow: 0 1px 2px rgb(0 0 0 / .06);
}
.chat-bubble p { margin: .5rem 0; line-height: 1.55; }
.chat-bubble p:first-child { margin-top: 0; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-name {
  font-weight: 700;
  color: #075e54;
  font-size: .875rem;
}
.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: linear-gradient(180deg, #25d366, #1ebe5d);
  border-color: #1da851;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px -2px rgb(37 211 102 / .45);
}
.btn-whatsapp:hover:not(:disabled) {
  background: linear-gradient(180deg, #1ebe5d, #1da851);
  box-shadow: 0 8px 20px -4px rgb(37 211 102 / .55);
}
.btn-whatsapp svg { flex-shrink: 0; }

.guest-name { font-size: 1.5rem; font-weight: 600; margin: .25rem 0; }

/* Cards */
.card {
  border: 1px solid var(--stone-600);
  border-radius: .5rem;
  background: var(--stone-100);
  padding: 1rem;
}
.total-number { font-size: 2.25rem; font-weight: 600; margin: 0; }

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  padding: .5rem;
  border: 1px solid var(--stone-600);
  border-radius: .5rem;
  text-align: center;
  text-decoration: none;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / .1);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn-dark { background: var(--stone-600); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--stone-500); box-shadow: 0 6px 14px -4px rgb(0 0 0 / .3); }
.btn-dark:disabled { background: var(--stone-300); cursor: auto; }
.btn-outline { background: transparent; color: var(--stone-600); }
.btn-outline:hover:not(:disabled) { color: var(--stone-500); box-shadow: 0 6px 14px -4px rgb(0 0 0 / .15); }
.btn-green { background: var(--green-500); color: #fff; }
.btn-green:hover { background: var(--green-400); }
.btn-sm { display: inline-block; width: auto; padding: .25rem .75rem; font-size: .875rem; }

.btn:focus-visible,
.btn-delete:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--stone-500);
  outline-offset: 2px;
}

/* Destructive table action: ghost-style with trash icon */
.btn-delete {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .5rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  background: transparent;
  color: #dc2626;
  font-size: .8125rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn-delete:hover { background: #fef2f2; border-color: #fecaca; }

.flex { display: flex; }
.gap-2 { gap: .5rem; }
.flex-grow { flex-grow: 1; }

/* Guest chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  border: 1px solid var(--stone-600);
  border-radius: .5rem;
  padding: .25rem .75rem;
  font-size: .875rem;
}
.chip.sent { border-style: dashed; color: var(--stone-500); }

/* Invitation text */
.invitation-text {
  background: #fff;
  border: 1px solid var(--stone-300);
  border-radius: .5rem;
  padding: 1rem;
  font-size: 1rem;
}

/* Forms */
select {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--stone-300);
  border-radius: .5rem;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}
.hidden { display: none !important; }
.guest-row { display: flex; gap: .5rem; }
.guest-row + .guest-row { margin-top: .5rem; }
.guest-row input[type=text] { flex: 1; }
.guest-row input[type=number] { flex: 0 0 5.5rem; }
.invitation-editor textarea {
  min-height: 400px;
  resize: vertical;
  line-height: 1.6;
}
.form-card {
  background: #fff;
  border: 1px solid var(--stone-300);
  border-radius: .5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / .05);
}
.field { margin-bottom: 1.25rem; }
.field label { margin: 0 0 .25rem; }
.field-hint { margin: .375rem 0 0; font-size: .8125rem; color: var(--stone-500); }
label { display: block; margin: 1rem 0 .25rem; font-size: .875rem; color: var(--stone-600); }
input[type=text], input[type=password], input[type=number], textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--stone-300);
  border-radius: .5rem;
  font-size: 1rem;
  font-family: inherit;
}
.error { color: #b91c1c; font-size: .875rem; margin: .25rem 0 0; }
.notice {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
  border-radius: .5rem;
  padding: .75rem 1rem;
}
.alert {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: .5rem;
  padding: .75rem 1rem;
}

/* Tables */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--stone-300);
  border-radius: .75rem;
  padding: .625rem .75rem;
  box-shadow: 0 1px 2px rgb(0 0 0 / .05);
  margin-bottom: 1rem;
}
.filter-pills { display: inline-flex; flex-wrap: wrap; gap: .25rem; flex-basis: 100%; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .65rem;
  border: 1px solid var(--stone-300);
  border-radius: 999px;
  background: transparent;
  color: var(--stone-600);
  font-size: .8125rem;
  font-family: inherit;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.pill-btn:hover { border-color: var(--stone-500); color: var(--stone-800); }
.pill-btn.active {
  background: var(--stone-600);
  border-color: var(--stone-600);
  color: #fff;
}
.pill-btn .count {
  font-size: .6875rem;
  line-height: 1.25rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--stone-200);
  color: var(--stone-600);
}
.pill-btn.active .count { background: rgb(255 255 255 / .22); color: #fff; }
.filter-form .select-wrap {
  position: relative;
  display: inline-flex;
}
.filter-form select {
  width: auto;
  appearance: none;
  -webkit-appearance: none;
  padding: .4rem 1.9rem .4rem .6rem;
  font-size: .875rem;
}
.select-chevron {
  position: absolute;
  right: .55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  color: var(--stone-600);
  pointer-events: none;
}
.search-box { position: relative; flex: 1 1 12rem; min-width: 0; }
.search-icon {
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--stone-500);
  pointer-events: none;
}
.search-box input[type="search"] {
  width: 100%;
  padding: .4rem 1rem .4rem 2.15rem;
  border: 1px solid var(--stone-200);
  border-radius: 999px;
  background-color: var(--stone-100);
  appearance: none;
  -webkit-appearance: none;
  font-size: .875rem;
  font-family: inherit;
  color: var(--stone-800);
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.search-box input[type="search"]::placeholder { color: var(--stone-400); }
.search-box input[type="search"]:hover { background-color: #fff; border-color: var(--stone-300); }
.search-box input[type="search"]:focus {
  background-color: #fff;
  border-color: var(--stone-600);
  box-shadow: 0 0 0 3px rgb(87 83 78 / .12);
  outline: none;
}
.filter-form .btn-sm { margin-left: 0; min-width: 4.5rem; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
  text-align: left;
  padding: .375rem .5rem;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--stone-500);
  border-bottom: 1px solid var(--stone-300);
}
td {
  padding: .4rem .5rem;
  border-bottom: 1px solid var(--stone-200);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .15s ease; }
tbody tr:hover { background: var(--stone-50); }
.guest-name-cell { font-weight: 600; }
.guest-cat {
  display: inline-block;
  padding: .1rem .5rem;
  border: 1px solid var(--stone-200);
  border-radius: 999px;
  background: var(--stone-100);
  font-size: .75rem;
  color: var(--stone-600);
  white-space: nowrap;
}
.guest-pax { font-weight: 600; }
th.num, td.num { text-align: right; }
.sent-indicator {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--stone-500);
  font-size: .8125rem;
  white-space: nowrap;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--stone-300); flex-shrink: 0; }
.dot.sent { background: #22c55e; }
.guest-edit {
  color: var(--stone-500);
  font-size: .8125rem;
  text-underline-offset: 2px;
}
.guest-edit:hover { color: var(--stone-700); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .375rem;
  margin-top: 1.25rem;
}
.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 .5rem;
  border: 1px solid var(--stone-300);
  border-radius: .5rem;
  background: #fff;
  color: var(--stone-600);
  font-size: .875rem;
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
a.pagination-link:hover { border-color: var(--stone-500); color: var(--stone-800); }
.pagination-link.current {
  background: var(--stone-600);
  border-color: var(--stone-600);
  color: #fff;
  cursor: default;
}
.pagination-link.disabled { opacity: .4; pointer-events: none; }

/* Fixed bottom bar (share page) */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid var(--stone-600);
  background: #fff;
  box-shadow: 0 -4px 6px -1px rgb(0 0 0 / .1);
}
.bottom-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}
.bottom-inner form { display: flex; }
.bottom-inner form .btn { flex: 1; }

/* App shell with sidebar */
.shell { display: flex; min-height: 100vh; --sidebar-width: 240px; }
.shell.collapsed { --sidebar-width: 0px; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--stone-800);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.5rem 1rem;
  transition: width .2s ease;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: "Bricolage Grotesque", "Figtree", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  white-space: nowrap;
}
.sidebar-nav { display: flex; flex-direction: column; gap: .25rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .75rem;
  border-radius: .5rem;
  color: var(--stone-300);
  text-decoration: none;
  font-size: .875rem;
  white-space: nowrap;
}
.nav-link:hover { background: rgb(255 255 255 / .1); color: #fff; }
.nav-link.active { background: #fff; color: var(--stone-800); font-weight: 600; }
.nav-link svg, .sidebar-logout svg { flex-shrink: 0; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: .5rem; }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: .625rem;
  background: none;
  border: none;
  padding: .25rem .75rem;
  color: var(--stone-400);
  font-family: inherit;
  font-size: .8125rem;
  cursor: pointer;
  white-space: nowrap;
}
.sidebar-logout:hover { color: #fff; }
.content { flex: 1; min-width: 0; }

/* Floating button to toggle a collapsed/hidden sidebar */
.sidebar-fab {
  display: none;
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 80;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: .5rem;
  background: var(--stone-800);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / .25);
}
.sidebar-fab:hover { background: var(--stone-600); }
.sidebar-fab svg { flex-shrink: 0; }
.fab-icon-open { display: flex; }
.fab-icon-close { display: none; }
.shell:not(.collapsed) .fab-icon-open { display: none; }
.shell:not(.collapsed) .fab-icon-close { display: flex; }
.shell.collapsed .sidebar-fab { display: flex; }
/* Reserve constant top space for the FAB while a sidebar exists, so the page title never moves */
.shell.has-sidebar main { padding-top: 4rem; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    width: min(280px, 85vw);
    z-index: 70;
    transform: translateX(-100%);
    transition: width .2s ease, transform .2s ease;
  }
  .shell:not(.collapsed) .sidebar { transform: translateX(0); }
  /* FAB always visible on mobile: hamburger when closed, X at the drawer's top-right when open */
  .sidebar-fab { display: flex; transition: left .2s ease; }
  .shell:not(.collapsed) .sidebar-fab { left: calc(min(280px, 85vw) - 3.25rem); }
}

@media (min-width: 769px) {
  .bottom-bar { left: var(--sidebar-width); }
  .shell.collapsed .sidebar { display: none; }
  .shell:not(.collapsed) .sidebar-fab { display: none; }
}

/* Wish stats + badges */
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat-number { font-size: 1.75rem; font-weight: 600; margin: 0; }
.stat-label { margin: 0; font-size: .8125rem; color: var(--stone-500); }
.stat-attend { border-color: #86efac; }
.stat-may { border-color: #fde68a; }
.stat-absent { border-color: #fca5a5; }
.wish-type {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  white-space: nowrap;
}
.wish-attend { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.wish-may_attend { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.wish-absent { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.wish-message { white-space: pre-line; margin: 0; }
.wish-msg-block {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-bottom: .5rem;
}
.wish-msg-toggle {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--stone-500);
  font-family: inherit;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  align-self: flex-start;
}
.wish-msg-toggle:hover { color: var(--stone-800); }
.wish-chev { transition: transform .15s ease; transform: rotate(180deg); }
.wish-msg-block.collapsed .wish-chev { transform: rotate(0deg); }
.wish-msg-block.collapsed .wish-message { display: none; }
.wish-toggle {
  padding: .2rem .5rem;
  border: 1px solid var(--stone-300);
  border-radius: .5rem;
  background: transparent;
  color: var(--stone-600);
  font-size: .8125rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.wish-toggle:hover { border-color: var(--stone-500); color: var(--stone-800); }

/* Top bar (dashboard) */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Responsive: filter/search compact, stat cards stack, tables become cards */
@media (max-width: 640px) {
  .page-header { flex-direction: column; align-items: stretch; gap: .75rem; }
  .page-actions { flex-direction: column; }
  .page-actions .btn { width: 100%; }
  .filter-form { padding: .5rem .625rem; gap: .375rem; }
  .filter-pills { gap: .375rem; }
  .search-box { flex: 1 1 8rem; }
  .filter-form .btn-sm { flex: 1 1 auto; }
  .stat-cards { grid-template-columns: 1fr; gap: .75rem; }

  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody tr {
    border: 1px solid var(--stone-300);
    border-radius: .5rem;
    margin-bottom: .5rem;
    padding: .375rem .75rem .5rem;
  }
  tbody td {
    border: none;
    padding: .25rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
  tbody td::before {
    content: attr(data-label);
    font-size: .75rem;
    font-weight: 600;
    color: var(--stone-500);
  }
  td.guest-actions::before { content: none; }
  td.guest-actions {
    justify-content: flex-end;
    padding-top: .375rem;
  }
  td.wish-actions::before { content: none; }
  td.wish-actions {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding-top: .375rem;
  }
}
