:root {
  --purple: #6c3ce1;
  --purple-dark: #4f2db8;
  --purple-soft: #8b5cf6;
  --purple-light: #ede9fe;
  --purple-mid: #ddd6fe;
  --teal: #06d6a0;
  --teal-dark: #059669;
  --coral: #ff6b6b;
  --yellow: #ffd93d;
  --amber: #f59e0b;
  --bg: #f5f3ff;
  --dark: #1a1a2e;
  --muted: #9ca3af;
  --line: #f3f4f6;
  --card-shadow: 0 2px 12px rgba(108, 60, 225, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
  --app-max: 480px;
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Outfit", var(--font);
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  height: 100%;
  background: #ece8ff;
  color: var(--dark);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
}

[hidden] {
  display: none !important;
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

input,
textarea {
  font-size: 16px;
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"],
input[type="time"] {
  display: block;
  min-width: 0;
  min-height: 24px;
  -webkit-appearance: auto;
  appearance: auto;
}

img {
  max-width: 100%;
  height: auto;
}

#app {
  width: min(100%, var(--app-max));
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* Forms wrap header + scroll + action-bar; keep the same column flex chain. */
.screen > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.screen-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.has-nav .screen-scroll {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 28px);
}

.pad {
  padding-left: 20px;
  padding-right: 20px;
}

.header {
  padding: calc(var(--safe-top) + 12px) 20px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.grad {
  background: linear-gradient(160deg, #4f2db8 0%, #6c3ce1 60%, #8b5cf6 100%);
  color: #fff;
  border-bottom: 0;
}

.grad-flat {
  background: linear-gradient(160deg, #4f2db8 0%, #6c3ce1 100%);
  color: #fff;
  border-bottom: 0;
}

.display {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.mono {
  font-family: var(--mono);
  font-weight: 500;
}

.logo {
  font-family: var(--display);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.04em;
  color: var(--dark);
}

.logo .mark {
  color: #d97706;
}

.logo.light {
  color: #fff;
}

.logo.xl {
  font-size: 48px;
}

.row {
  display: flex;
  align-items: center;
}

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

.col {
  display: flex;
  flex-direction: column;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

.muted { color: var(--muted); }
.soft { color: rgba(255, 255, 255, 0.65); }
.tiny { font-size: 10px; }
.xs { font-size: 11px; }
.sm { font-size: 13px; }
.md { font-size: 14px; }
.lg { font-size: 18px; }
.xl { font-size: 20px; }
.bold { font-weight: 700; }
.semibold { font-weight: 600; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.teal { color: var(--teal); }
.coral { color: var(--coral); }
.purple { color: var(--purple); }
.upper {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 700;
}
.section {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 12px;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
}

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

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 16px; }
.avatar-ring { box-shadow: 0 0 0 2px #fff; }

.faces { display: flex; }
.faces .avatar,
.faces .more {
  margin-left: -8px;
}
.faces .avatar:first-child,
.faces .more:first-child { margin-left: 0; }
.more {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 2px solid #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #6b7280;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
}
.pill-active { background: var(--purple-light); color: var(--purple); }
.pill-settling { background: #fffbeb; color: #d97706; }
.pill-settled { background: #f3f4f6; color: #6b7280; }
.pill-on-dark { background: rgba(255, 255, 255, 0.2); color: #fff; }
.pill-live { background: var(--teal); color: #fff; }
.pill-warn { background: var(--yellow); color: var(--dark); }
.pill-muted { background: #e5e7eb; color: #6b7280; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f3f4f6;
  color: #6b7280;
}
.icon-btn.glass {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.icon-btn.lg { width: 40px; height: 40px; }

.btn {
  height: 56px;
  border-radius: 16px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, #6c3ce1, #8b5cf6);
}
.btn:disabled { opacity: 0.4; }
.btn-teal { background: linear-gradient(135deg, #06d6a0, #059669); }
.btn-white {
  background: #fff;
  color: var(--purple);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.btn-sm {
  height: auto;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--purple);
  color: #fff;
}
.btn-soft {
  height: auto;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--purple-light);
  color: var(--purple);
}
.chip-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.seg {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
}
.seg button,
.seg a {
  flex: 1;
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-align: center;
}
.seg button.on,
.seg a.on {
  background: #fff;
  color: var(--purple);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.field {
  width: 100%;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
}
.field:focus-within { border-color: var(--purple); }
.field input,
.field textarea { color: var(--dark); font-weight: 500; }
.field textarea { resize: none; min-height: 72px; }
.label {
  display: block;
  margin-bottom: 8px;
  color: #4b5563;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f3f4f6;
  border-radius: 16px;
  padding: 12px 16px;
}

.choice {
  border: 2px solid #f3f4f6;
  background: #fff;
  border-radius: 16px;
  transition: border-color 0.15s, background 0.15s;
}
.choice.on {
  border-color: var(--purple);
  background: var(--purple-light);
}
.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.choice-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 16px;
  border: 2px solid #f3f4f6;
  background: #f9fafb;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}
.choice-tile.on {
  border-color: var(--purple);
  background: var(--purple-light);
  color: var(--purple);
}

.check {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.check.on {
  border-color: var(--purple);
  background: var(--purple);
  color: #fff;
}

.action-bar {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 16px 20px calc(16px + var(--safe-bottom));
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: none;
  align-items: flex-end;
  justify-content: space-around;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + var(--safe-bottom));
}
.bottom-nav.show { display: flex; }
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.nav-btn.on { color: var(--purple); }
.nav-fab {
  width: 56px;
  height: 56px;
  margin-top: -22px;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(108, 60, 225, 0.45);
}
.nav-fab:active { transform: scale(0.95); }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
}
.sheet {
  width: 100%;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 24px 24px calc(24px + var(--safe-bottom));
  max-height: 78%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fade-up 0.28s ease both;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 60;
  max-width: calc(100% - 40px);
  background: var(--dark);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(26, 26, 46, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}
#app:has(#bottom-nav.show) .toast {
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.balance {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 16px;
}
.balance-split {
  display: flex;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}
.balance-split > div { flex: 1; text-align: center; }
.balance-split > .vdiv {
  flex: 0 0 1px;
  width: 1px;
  align-self: stretch;
  background: rgba(255, 255, 255, 0.35);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 16px;
  padding: 12px 6px;
  box-shadow: var(--card-shadow);
  font-size: 10px;
  font-weight: 500;
  color: #4b5563;
  text-align: center;
  line-height: 1.2;
}
.emoji-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
}
.emoji-sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--purple-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.event-hero {
  padding: 16px 16px 12px;
  color: #fff;
}
.event-body { background: #fff; padding: 16px; }
.hairline {
  border-top: 1px solid #f9fafb;
  margin-top: 12px;
  padding-top: 12px;
}

.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  flex-shrink: 0;
}
.tabs button,
.tabs a {
  flex: 1;
  padding: 12px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: capitalize;
  border-bottom: 2px solid transparent;
  text-align: center;
}
.tabs button.on,
.tabs a.on {
  color: var(--purple);
  border-bottom-color: var(--purple);
}

.me { box-shadow: 0 0 0 2px var(--purple), var(--card-shadow); }

.steps { display: flex; align-items: center; gap: 8px; }
.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: #f3f4f6;
  color: var(--muted);
}
.step-dot.now { background: var(--purple); color: #fff; }
.step-dot.done { background: var(--teal); color: #fff; }
.step-line { flex: 1; height: 1px; background: #f3f4f6; min-width: 12px; }

.amount-hero { text-align: center; background: #fff; padding: 24px 20px; border-bottom: 1px solid var(--line); }
.amount-hero input {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 48px;
  text-align: center;
  max-width: 220px;
}
.amount-hero .dollar {
  font-family: var(--display);
  font-weight: 900;
  font-size: 48px;
  color: #d1d5db;
}

.stat-row { display: flex; gap: 12px; }
.stat {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px;
}
button.stat {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.stat-tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  z-index: 20;
  white-space: nowrap;
  background: var(--dark);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.stat-tooltip.show { opacity: 1; }
.stat-tooltip::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-bottom-color: var(--dark);
}
.stat-tooltip.above {
  top: auto;
  bottom: calc(100% + 8px);
}
.stat-tooltip.above::after {
  bottom: auto;
  top: 100%;
  border-bottom-color: transparent;
  border-top-color: var(--dark);
}
.progress { display: flex; gap: 4px; margin-top: 12px; }
.progress i {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  display: block;
}
.progress i.on { background: var(--purple); }

.code-row { display: flex; gap: 8px; justify-content: center; }
.code-box {
  width: 44px;
  height: 56px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 20px;
  color: #d1d5db;
  padding: 0;
  cursor: text;
  -webkit-appearance: none;
  appearance: none;
}
button.code-box { font: inherit; }
.code-box.filled {
  border-color: var(--purple);
  background: var(--purple-light);
  color: var(--purple);
}
.code-box.caret { border-color: var(--purple); animation: pulse 1s ease infinite; }

.scan-stage {
  position: relative;
  flex: 1;
  min-height: 280px;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.scan-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.7); }
.scan-frame { position: relative; z-index: 1; width: 256px; height: 256px; }
.scan-frame.wide { width: 288px; height: 208px; }
.corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--purple);
  border-style: solid;
}
.corner.tl { top: 0; left: 0; border-width: 4px 0 0 4px; }
.corner.tr { top: 0; right: 0; border-width: 4px 4px 0 0; }
.corner.bl { bottom: 0; left: 0; border-width: 0 0 4px 4px; }
.corner.br { bottom: 0; right: 0; border-width: 0 4px 4px 0; }
.scan-line {
  position: absolute;
  left: 16px;
  right: 16px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6c3ce1, transparent);
  animation: scan 2s linear infinite;
}
.shutter {
  width: 80px;
  height: 80px;
  border-radius: 999px;
  border: 4px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shutter span {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--card-shadow); }
.settings button,
.settings a {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #f9fafb;
}
.settings button:last-child,
.settings a:last-child { border-bottom: 0; }
.settings button:active,
.settings a:active { background: #f9fafb; }
.set-ico {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: var(--purple-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.pay-card {
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  background: linear-gradient(135deg, #4f2db8, #6c3ce1);
  color: #fff;
  margin-bottom: 20px;
}
.note-banner {
  background: var(--purple-light);
  border-radius: 16px;
  padding: 12px 16px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 500;
}

.splash {
  background: linear-gradient(145deg, #4f2db8 0%, #6c3ce1 50%, #8b5cf6 100%);
  color: #fff;
}
.splash-mark {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: #fff;
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 900;
  font-size: 36px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.blob {
  position: absolute;
  pointer-events: none;
}
.dash {
  border: 2px dashed rgba(108, 60, 225, 0.3);
  border-radius: 16px;
  background: transparent;
  width: 100%;
  padding: 20px;
  color: var(--purple);
}

.empty { text-align: center; padding: 48px 16px; }

.qr {
  width: 128px;
  height: 128px;
  background: var(--dark);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.qr i { border-radius: 1px; background: transparent; display: block; }
.qr i.on { background: #fff; }

.ai-pulse { animation: pulse 1.2s ease infinite; }
.shimmer {
  background: linear-gradient(90deg, #ede9fe 25%, #d8d0ff 50%, #ede9fe 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

.hidden-input {
  position: absolute;
  opacity: 0;
  height: 1px;
  width: 1px;
  left: 0;
  top: 0;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scan {
  0% { top: 12%; }
  50% { top: 82%; }
  100% { top: 12%; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.fade-up { animation: fade-up 0.4s ease both; }

.auth-top {
  padding: calc(var(--safe-top) + 20px) 20px 28px;
  background: linear-gradient(160deg, #4f2db8 0%, #6c3ce1 62%, #8b5cf6 100%);
  color: #fff;
  flex-shrink: 0;
}
.auth-top .logo { margin-top: 8px; }
.form-error {
  background: rgba(255, 107, 107, 0.12);
  color: #e11d48;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.field.pass { position: relative; }
.field.pass input { padding-right: 44px; }
.pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
}
.text-btn {
  color: var(--purple);
  font-weight: 700;
  font-size: 14px;
}
.auth-hint {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.5;
}

@media (min-width: 520px) {
  body { background: #ece8ff; }
  #app { box-shadow: 0 0 0 1px rgba(108, 60, 225, 0.08); }
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
a.btn {
  display: flex;
  align-items: center;
  justify-content: center;
}
a.btn-sm,
a.btn-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
a.press:not(.row) {
  display: block;
}

/* Event detail tabs — class only (no :target; it fights replaceState in WebViews). */
.event-panel {
  display: none !important;
}
.event-panel.is-active {
  display: block !important;
}

/* Discussion (event / expense / activity) */
.bs-discussion .field {
  padding: 8px 12px;
}
.bs-discussion .field textarea.de-discussion-input,
.bs-discussion .field textarea[data-reply-input],
.bs-discussion .field textarea[data-edit-input] {
  display: block;
  width: 100%;
  min-height: 40px;
  max-height: 160px;
  overflow: hidden;
  line-height: 1.4;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bs-discussion .field textarea.de-discussion-input::-webkit-scrollbar,
.bs-discussion .field textarea[data-reply-input]::-webkit-scrollbar,
.bs-discussion .field textarea[data-edit-input]::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.bs-discussion .field textarea.is-scrollable {
  overflow-y: auto;
}
.bs-discussion-bubble {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px 12px 12px 4px;
  background: #f3f4f6;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.bs-discussion-bubble.mine {
  background: #6C3CE112;
}
.bs-discussion-replies {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding-left: 10px;
  border-left: 2px solid #e5e7eb;
}
.bs-discussion-reply,
.bs-discussion-reply-box {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.bs-discussion-reply-box {
  margin-top: 10px;
}
.bs-discussion-menu {
  position: relative;
  flex-shrink: 0;
}
.bs-discussion-menu-btn {
  background: none;
  border: 0;
  padding: 0 4px;
  color: #9ca3af;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.bs-discussion-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  min-width: 110px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.bs-discussion-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
}
.bs-discussion-dropdown button:hover {
  background: #f3f4f6;
}
.bs-discussion-dropdown button.danger {
  color: #FF6B6B;
}
.bs-discussion-edit-box {
  margin-top: 8px;
}
.bs-discussion-thread {
  gap: 0;
}

.bs-report-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  min-width: 150px;
  padding: 6px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.bs-report-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
}
.bs-report-dropdown button:hover {
  background: #f3f4f6;
}
#de-report-modal:not([hidden]) {
  display: flex;
}
.bs-discussion-item + .bs-discussion-item {
  margin-top: 0;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}

body:has(#active:target) .event-card[data-status="settled"],
body:has(#past:target) .event-card:not([data-status="settled"]) {
  display: none;
}
body:has(#active:target) .seg a.on,
body:has(#past:target) .seg a.on {
  background: transparent;
  color: #6b7280;
  box-shadow: none;
}
body:has(#active:target) .seg a[href="#active"],
body:has(#past:target) .seg a[href="#past"] {
  background: #fff;
  color: var(--purple);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
