:root {
  --bg0: #07080d;
  --bg1: #0f111a;
  --glass: rgba(255, 255, 255, 0.06);
  --glass2: rgba(255, 255, 255, 0.1);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.94);
  --muted: rgba(255, 255, 255, 0.55);
  --cyan: #34e1ff;
  --violet: #a78bfa;
  --green: #4ade80;
  --red: #fb7185;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --tab-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(1200px 800px at 20% -10%, rgba(52, 225, 255, 0.12), transparent 55%),
    radial-gradient(900px 600px at 100% 20%, rgba(167, 139, 250, 0.14), transparent 50%),
    var(--bg0);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body.sheet-lock { overflow: hidden; }

.app-root {
  min-height: 100dvh;
  padding-bottom: calc(var(--safe-b) + 84px);
}

.ios-blur {
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  background: var(--glass);
  border: 1px solid var(--stroke);
}

.screen {
  max-width: 440px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--safe-b) + 96px);
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 8px 0 4px;
}

.hero-sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(52, 225, 255, 0.1);
  border: 1px solid rgba(52, 225, 255, 0.25);
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.brand-live-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-live-row .brand-mark-sm {
  margin-right: 0;
}

.header-user-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-header {
  position: relative;
  margin-top: 0;
  padding-top: 0;
  margin-bottom: 14px;
}

.app-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.app-header-row {
  padding-bottom: 10px;
}

.app-header-user {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(52, 225, 255, 0.1);
  border: 1px solid rgba(52, 225, 255, 0.25);
}

.app-header-pill {
  min-height: 30px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.auth-screen .auth-header-host .app-header {
  margin-bottom: 10px;
}

.auth-screen .auth-header-host .header-user-live .auth-mode-pill {
  min-height: 30px;
  white-space: nowrap;
}

.brand-text {
  display: flex;
  align-items: center;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  position: relative;
  background:
    radial-gradient(circle at 24% 22%, rgba(255, 255, 255, 0.65) 0 14%, transparent 20%),
    radial-gradient(circle at 78% 24%, rgba(255, 255, 255, 0.45) 0 13%, transparent 20%),
    linear-gradient(135deg, #22d3ee 0%, #4ade80 38%, #a78bfa 68%, #f472b6 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.24), 0 10px 22px rgba(34, 211, 238, 0.35);
}

.brand-mark::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  left: 8px;
  top: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 0 1 16 0'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35));
}

.brand-mark::after {
  content: none;
}

.brand-mark-sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.brand-mark-sm::before {
  width: 22px;
  height: 22px;
  left: 4px;
  top: 4px;
}

.brand-mark-sm::after {
  content: none;
}

.card {
  border-radius: var(--radius-xl);
  padding: 18px;
  margin-bottom: 14px;
}

.input {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  outline: none;
}

.input:focus {
  border-color: rgba(52, 225, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(52, 225, 255, 0.12);
}

select.input.phone-country {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.phone-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  min-width: 52px;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  color: var(--cyan);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--stroke);
  border-radius: 14px;
}

.phone-local {
  flex: 1;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, #22d3ee, #a78bfa);
  color: #0a0a0f;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.btn-block { width: 100%; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.field-label {
  display: block;
  margin: 2px 0 8px;
}

.helper-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 8px 0 18px;
}

.helper-text.tight {
  margin-top: 6px;
}

.action-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 2px 0;
}

.section-divider {
  position: relative;
  margin-top: 18px;
  padding-top: 18px;
  margin-bottom: 22px;
}

.section-divider::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.section-divider-tight {
  position: relative;
  margin-top: 24px;
  padding-top: 18px;
  margin-bottom: 24px;
}

.section-divider-tight::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.section-header {
  font-size: 22px;
  margin: 0 0 18px;
}

.profile-title {
  text-align: center;
}

.profile-phone-row {
  margin-top: 10px;
  margin-bottom: 10px;
}

.hidden { display: none !important; }

.seg-tabs {
  display: flex;
  align-items: center;
  border-radius: 18px;
  padding: 5px;
  gap: 5px;
  margin: 0 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, rgba(52, 225, 255, 0.08), rgba(167, 139, 250, 0.08)), rgba(15, 17, 26, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 28px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.app-footer-tabs {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 10px);
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px));
  z-index: 90;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, rgba(52, 225, 255, 0.08), rgba(167, 139, 250, 0.08)), rgba(15, 17, 26, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.app-footer-tabs .seg-tabs {
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.app-footer-tabs .tab {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  min-height: 52px;
  line-height: 1.1;
}

.app-footer-tabs .tab svg {
  width: 18px;
  height: 18px;
}


.app-support-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--safe-b) + 88px);
  width: 52px;
  height: 52px;
  border-radius: 999px;
  padding: 0;
  z-index: 95;
  background: linear-gradient(135deg, rgba(52, 225, 255, 0.22), rgba(167, 139, 250, 0.24)), rgba(15, 17, 26, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.app-support-fab svg {
  width: 30px;
  height: 30px;
  opacity: 1;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 9px 8px;
  border-radius: 13px;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.16s ease;
}

.tab svg { opacity: 0.7; }

.tab:hover {
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.05);
}

.tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 225, 255, 0.45);
}

.tab.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(52, 225, 255, 0.26), rgba(167, 139, 250, 0.24));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 16px rgba(52, 225, 255, 0.18);
  transform: translateY(-1px);
}

.tab.active svg { opacity: 1; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

.table-wrap {
  overflow: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th, table.data td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.row-action-cell {
  white-space: nowrap;
}

.row-action-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.row-edit-btn,
.row-remove-btn {
  padding: 7px 10px;
  font-size: 12px;
  height: 32px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.invitee-name-input {
  text-align: center;
}

table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

table.data tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.badge-yes { background: rgba(74, 222, 128, 0.15); color: var(--green); }
.badge-no { background: rgba(251, 113, 133, 0.15); color: var(--red); }
.badge-maybe { background: rgba(250, 204, 21, 0.12); color: #facc15; }
.badge-pending { background: rgba(255, 255, 255, 0.06); color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  border-radius: var(--radius-lg);
  padding: 14px;
  text-align: center;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.25);
}

.stat b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sheet.is-open {
  pointer-events: auto;
  opacity: 1;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(16px + var(--safe-b));
  background: linear-gradient(180deg, #141622, #0c0d14);
  border: 1px solid var(--stroke);
  border-bottom: none;
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet.is-open .sheet-panel {
  transform: translateY(0);
}

.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  margin: 8px auto 16px;
}

.sheet h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
}

textarea.input {
  min-height: 100px;
  resize: vertical;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.action-quick-actions {
  align-items: stretch;
}

.action-item {
  flex: 1 1 180px;
  min-width: 0;
}

.action-item .action-note {
  margin-top: 8px;
}

.table-guide {
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-top: 4px;
}

.billing-card {
  margin-bottom: 14px;
}

.billing-upgrades {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.table-guide-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.event-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.event-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.event-del {
  padding: 8px 10px;
  font-size: 12px;
}

.event-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.event-item-text {
  min-width: 0;
}

.event-item-text strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--stroke);
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.25);
}

.event-thumb-ph {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px dashed var(--stroke);
  background: rgba(255, 255, 255, 0.04);
}

.event-item.active {
  border-color: rgba(52, 225, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(52, 225, 255, 0.15);
}

.event-item small { color: var(--muted); }

.card-thumb-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--stroke);
  cursor: zoom-in;
  margin-bottom: 14px;
  max-height: 180px;
}

.card-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  vertical-align: middle;
}

.card-thumb-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

.card-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
}

.card-lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-lg);
  border: 1px solid var(--stroke);
}

.card-lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox {
  width: 18px;
  height: 18px;
}

.guest-page {
  min-height: 100dvh;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
}

.guest-card-thumb-wrap {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--stroke);
  cursor: zoom-in;
  margin-bottom: 12px;
  max-height: 48vh;
}

.guest-card-thumb {
  width: 100%;
  height: min(220px, 42vh);
  object-fit: cover;
  display: block;
  vertical-align: middle;
  background: rgba(0, 0, 0, 0.35);
}

.guest-card-thumb-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.fallback-link {
  display: block;
  text-align: center;
  margin: 12px 0 20px;
  color: var(--cyan);
  font-size: 14px;
  text-decoration: none;
  font-weight: 600;
}

.rsvp-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.rsvp-btn {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.rsvp-btn.sel {
  border-color: rgba(52, 225, 255, 0.5);
  background: rgba(52, 225, 255, 0.12);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  transition: 0.25s ease;
  z-index: 200;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(20, 22, 34, 0.95);
  border: 1px solid var(--stroke);
  font-size: 14px;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
  font-size: 14px;
}

.loader {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
