:root {
  /* Fondo verde merino y tinta verde muy oscura */
  --paper: #D7E8DA;
  --card: #FFFFFF;
  --paper-2: #E8F2EA;
  --ink: #142319;
  --muted: #536657;
  --line: #C2D7C6;
  --accent: #3A3FD0;
  --accent-ink: #ffffff;
  --ok: #2F7340;
  --warn: #A86A0C;
  --danger: #C7372A;
  /* Degradados de los botones */
  --grad: linear-gradient(120deg, #2B38C4 0%, #6A3BD1 52%, #C2357F 100%);
  --grad-hover: linear-gradient(120deg, #3542D6 0%, #7746E0 52%, #D23E8B 100%);
  --grad-soft: linear-gradient(135deg, #FFFFFF 0%, #EEF7F0 100%);
  --grad-deep: linear-gradient(120deg, #143A29 0%, #1F6B4F 100%);
  --grad-ok: linear-gradient(135deg, #2F7340 0%, #4BA35F 100%);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius: 16px;
  --display: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --shadow: 0 1px 2px rgba(15, 40, 25, .07), 0 14px 32px -14px rgba(15, 40, 25, .3);
  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* Modo oscuro: el mismo verde, más profundo */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12261B; --card: #1A3325; --paper-2: #21402F; --ink: #EAF4EC; --muted: #9EBBA6; --line: #2C4D3A;
    --accent: #9AA2FF; --accent-ink: #ffffff;
    --grad-soft: linear-gradient(135deg, #21402F 0%, #1A3325 100%);
    --grad-deep: linear-gradient(120deg, #EAF4EC 0%, #BFE3CB 100%);
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 16px 40px -16px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --paper: #12261B; --card: #1A3325; --paper-2: #21402F; --ink: #EAF4EC; --muted: #9EBBA6; --line: #2C4D3A;
  --accent: #9AA2FF; --accent-ink: #ffffff;
  --grad-soft: linear-gradient(135deg, #21402F 0%, #1A3325 100%);
  --grad-deep: linear-gradient(120deg, #EAF4EC 0%, #BFE3CB 100%);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 16px 40px -16px rgba(0,0,0,.6);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ── Cabecera ───────────────────────────── */
.top {
  max-width: 1120px; margin: 0 auto; padding: 36px 20px 6px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.brand h1 {
  font: 800 clamp(2.6rem, 12.5vw, 5.2rem)/0.9 var(--display);
  letter-spacing: -0.045em; margin: 0; max-width: 9ch; text-wrap: balance;
}
.brand p { margin: 14px 0 0; color: var(--muted); max-width: 34ch; font-size: 1.02rem; }

/* ── Filtros (fijos al hacer scroll) ────── */
.filters {
  position: sticky; top: 0; z-index: 5;
  padding: 14px 20px 12px; margin: 10px auto 0; max-width: 1120px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  padding: 9px 15px; border-radius: 999px; font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pig, var(--ink)); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); box-shadow: none; }
.chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--paper); }

/* ── Lista ──────────────────────────────── */
.view { max-width: 1120px; margin: 0 auto; padding: 10px 20px 24px; }
.grid { display: grid; gap: 30px 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.section-title { font: 750 1.7rem/1.1 var(--display); letter-spacing: -0.03em; margin: 22px 0 16px; }

.card { position: relative; display: block; text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.card-media {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius-lg); overflow: hidden; isolation: isolate;
  background: var(--pig); box-shadow: var(--shadow);
}
.card.featured .card-media { aspect-ratio: 4 / 5; border-radius: var(--radius-xl); }
@media (min-width: 760px) {
  .card.featured { grid-column: span 2; }
  .card.featured .card-media { aspect-ratio: auto; height: 100%; min-height: 440px; }
  .card.featured { display: flex; flex-direction: column; }
  .card.featured .card-media { flex: 1; }
}
.card-media img, .card-media svg.canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media img { transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.card:hover .card-media img, .card:hover .card-media svg.canvas { transform: scale(1.035); }
.card-media svg.canvas { transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.card-media::after {               /* grano de papel */
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: var(--grain); opacity: .22; mix-blend-mode: overlay;
}
.shade {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(8, 8, 16, .82) 0%, rgba(8, 8, 16, .42) 38%, rgba(8, 8, 16, 0) 66%);
}
.overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; color: #fff;
  padding: 18px 20px 20px;
}
.overlay h2 {
  font: 720 1.55rem/1.06 var(--display); letter-spacing: -0.03em; margin: 10px 0 10px;
  text-wrap: balance; max-width: 22ch;
}
.card.featured .overlay { padding: 24px 24px 26px; }
.card.featured .overlay h2 { font-size: clamp(2rem, 8.5vw, 3rem); line-height: .98; letter-spacing: -0.04em; }
.overlay .meta { color: rgba(255,255,255,.86); }
.card .overlay .meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kind {
  display: inline-flex; align-items: center; margin: 0; font-size: .8rem; font-weight: 700;
  padding: 5px 11px; border-radius: 999px; color: #fff;
  background: rgba(255,255,255,.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.meta { margin: 0; color: var(--muted); font-size: .95rem; display: flex; gap: 7px; align-items: flex-start; }
.meta + .meta { margin-top: 2px; }
.meta svg { flex: none; width: 17px; height: 17px; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* Fecha en una mancha de pintura blanca */
.date-blob {
  position: absolute; left: 14px; top: 14px; z-index: 2; width: 66px; height: 66px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  color: var(--pig); line-height: 1;
}
.date-blob svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: #fff; filter: drop-shadow(0 4px 10px rgba(0,0,0,.18)); }
.date-blob .d, .date-blob .m { position: relative; }
.date-blob .d { font: 800 1.65rem/1 var(--display); letter-spacing: -0.04em; }
.date-blob .m { font-size: .72rem; font-weight: 800; margin-top: 2px; color: #15141c; }
.card.featured .date-blob, .hero .date-blob { width: 80px; height: 80px; left: 18px; top: 18px; }
.card.featured .date-blob .d, .hero .date-blob .d { font-size: 2rem; }

.badge {
  position: absolute; right: 14px; top: 14px; z-index: 2;
  background: rgba(255,255,255,.94); color: #15141c;
  font-weight: 750; font-size: .88rem; padding: 6px 12px; border-radius: 999px;
}
.badge.joined { background: #15141c; color: #fff; display: inline-flex; gap: 6px; align-items: center; }
.badge.joined::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #5fd17a; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 4px 0; min-height: 40px; }
.spots { font-size: .86rem; color: var(--muted); white-space: nowrap; }
.spots.low { color: var(--danger); font-weight: 700; }
.spots.pending { color: var(--warn); font-weight: 750; }

/* Caritas de quién va */
.people { display: flex; align-items: center; gap: 9px; min-width: 0; }
.faces { display: flex; }
.face {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-size: .74rem; font-weight: 800; color: #fff;
  border: 2px solid var(--paper); margin-left: -9px; background: var(--pig, var(--accent));
}
.face:first-child { margin-left: 0; }
.people-text { font-size: .88rem; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Estados vacíos y avisos */
.empty { text-align: center; padding: 56px 12px; color: var(--muted); max-width: 40ch; margin: 0 auto; }
.empty h2 { font: 750 1.7rem/1.1 var(--display); letter-spacing: -0.03em; color: var(--ink); margin: 0 0 10px; }
.empty .btn { margin-top: 14px; }
#notice { padding: 0 20px; }
.notice {
  max-width: 1080px; margin: 12px auto 0; padding: 12px 16px; border-radius: var(--radius);
  background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-size: .9rem; color: var(--muted);
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
}
.notice button { border: 0; background: none; font-weight: 700; cursor: pointer; padding: 0 4px; color: var(--ink); }

/* ── Barra inferior flotante ────────────── */
.tabbar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 10;
  transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 78%, transparent);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent), 0 14px 34px -12px rgba(10, 10, 30, .35);
}
.tabbar a {
  display: flex; align-items: center; gap: 7px; padding: 11px 15px; border-radius: 999px;
  text-decoration: none; font-size: .92rem; font-weight: 650; color: var(--muted); white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}
.tabbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; stroke-linecap: round; }
.tabbar a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* ── Botones ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 15px 24px; font-weight: 750; font-size: 1.02rem;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none;
  min-height: 54px; box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .12s ease, filter .2s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; cursor: default; box-shadow: none; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: var(--paper-2); color: var(--ink); border-radius: 999px;
  padding: 13px 20px; font-weight: 650; cursor: pointer; text-decoration: none; min-height: 54px;
  transition: transform .12s ease, background .2s ease;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--paper-2) 80%, var(--ink) 8%); }
.btn-ghost:active { transform: scale(.97); }
.btn-ghost.small { min-height: 0; padding: 9px 15px; font-size: .9rem; }
.btn svg, .btn-ghost svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.link-btn { border: 0; background: none; padding: 6px 2px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .92rem; }

/* ── Hojas (diálogos) ───────────────────── */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 620px;
  max-height: 95vh; max-height: 95dvh; border-radius: 30px 30px 0 0;
  background: var(--paper); color: var(--ink); overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: rise .34s cubic-bezier(.2,.85,.25,1); }
.sheet::backdrop { background: rgba(10, 10, 20, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes rise { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 30px; max-height: 90vh; } }
/* flex-basis auto + min-height 0: en Safari (iPhone) flex: 1 dejaba el contenido con altura 0 */
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; z-index: 6; width: 42px; height: 42px; border-radius: 50%;
  border: 0; display: grid; place-items: center; cursor: pointer; color: #fff;
  background: rgba(20, 20, 30, .4); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.sheet-small .sheet-close { background: var(--paper-2); color: var(--ink); }
.sheet-close svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.card-media.hero { border-radius: 0; aspect-ratio: 4 / 3.4; box-shadow: none; }
.hero .overlay { padding: 22px 24px 24px; }
.hero .overlay h2 { font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1; letter-spacing: -0.04em; margin-bottom: 0; }
.detail { padding: 22px 24px 18px; }
.detail .meta { font-size: 1rem; color: var(--ink); margin-bottom: 8px; }
.detail .meta svg { color: var(--muted); }
.detail .meta a { color: var(--accent); font-weight: 700; text-decoration: none; margin-left: 4px; }
.desc { margin: 20px 0; white-space: pre-line; max-width: 62ch; font-size: 1.04rem; line-height: 1.6; }
.box { border-radius: var(--radius); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); padding: 16px 18px; margin: 16px 0; }
.box h3 { font: 700 1.02rem/1.3 var(--sans); margin: 0 0 4px; }
.box p { margin: 0; color: var(--muted); }
.box.pending { background: color-mix(in srgb, var(--warn) 13%, var(--card)); box-shadow: none; }
.box.pending p, .box.done p { color: var(--ink); }
.box.done { background: color-mix(in srgb, var(--ok) 14%, var(--card)); box-shadow: none; }
.people-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.person { font-size: .86rem; font-weight: 600; background: var(--paper-2); border-radius: 999px; padding: 5px 11px; }
.actions {
  padding: 14px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
}
.actions .row { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.actions .btn { width: 100%; }
.joined-line { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.05rem; }
.joined-line .tick { width: 32px; height: 32px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; animation: pop .4s cubic-bezier(.3,1.6,.5,1); }
.joined-line .tick svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }

/* Formulario */
.form { padding: 30px 24px calc(22px + env(safe-area-inset-bottom, 0px)); }
.form h2 { font: 750 1.9rem/1.05 var(--display); letter-spacing: -0.035em; margin: 0 0 8px; padding-right: 44px; }
.form p.lead { margin: 0 0 20px; color: var(--muted); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; color: inherit; background: var(--card);
  border: 0; box-shadow: inset 0 0 0 1.5px var(--line); border-radius: 14px; padding: 15px 16px; font-size: 16px;
  transition: box-shadow .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.fine { font-size: .82rem; color: var(--muted); margin: 6px 0 16px; }
.form-error { color: var(--danger); font-weight: 650; font-size: .92rem; min-height: 1.2em; margin: 0 0 10px; }
.form .btn { width: 100%; }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 13px 20px; border-radius: 999px;
  font-weight: 650; width: max-content; max-width: calc(100% - 32px); text-align: center;
  box-shadow: 0 14px 34px -12px rgba(0,0,0,.4); transition: all .3s cubic-bezier(.2,.85,.25,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
dialog .toast { top: 16px; bottom: auto; transform: translate(-50%, -20px); }
dialog .toast.show { transform: translate(-50%, 0); }

/* Carga */
.skeleton { border-radius: var(--radius-lg); aspect-ratio: 1 / 1; background: var(--paper-2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* Una sola entrada orquestada al cargar */
.grid.intro .card { animation: enter .55s cubic-bezier(.2,.8,.2,1) both; }
.grid.intro .card:nth-child(2) { animation-delay: .06s; }
.grid.intro .card:nth-child(3) { animation-delay: .12s; }
.grid.intro .card:nth-child(n+4) { animation-delay: .18s; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Personas ───────────────────────────── */
.avatar {
  --size: 40px; flex: none; width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden;
  display: inline-grid; place-items: center; background: var(--pig, var(--accent)); color: #fff;
  font: 800 calc(var(--size) * .42)/1 var(--display);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { --size: 30px; border: 2px solid var(--paper); margin-left: -9px; }
.avatar.xs:first-child { margin-left: 0; }
.avatar.md { --size: 54px; }
.avatar.xl { --size: 112px; box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--line); }
.avatar.plus { background: var(--paper-2); color: var(--ink); font: 700 .95rem/1 var(--sans); }
.avatar.ghost { background: var(--paper-2); color: var(--muted); }
.avatar.ghost svg { width: 40%; height: 40%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.people-text b { color: var(--ink); font-weight: 700; }
.muted { color: var(--muted); }

.attendees { margin: 24px 0 8px; }
.att-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.att-count { margin: 0; font-size: 1.05rem; }
.att-count b { font: 800 2rem/1 var(--display); letter-spacing: -0.04em; margin-right: 4px; }
.att-left { font-size: .88rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.att-left.low { color: var(--danger); }
.meter { height: 6px; border-radius: 99px; background: var(--paper-2); margin: 12px 0 4px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--pig, var(--accent)); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 14px 6px; margin-top: 16px; }
.att { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.att > span:last-child { font-size: .8rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att:hover .avatar { transform: translateY(-2px); }
.att .avatar { transition: transform .2s ease; }

/* Perfil */
.profile { max-width: 560px; margin: 8px auto 0; }
.profile-head { display: flex; align-items: center; gap: 20px; margin: 8px 0 22px; }
.profile-head h2 { font: 780 1.9rem/1.05 var(--display); letter-spacing: -0.035em; margin: 0 0 6px; }
.profile-head p { margin: 0; color: var(--muted); }
.profile .box p { white-space: pre-line; }
.profile-empty .avatar { margin: 0 auto 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.tag {
  display: inline-flex; align-items: center; border: 0; font: inherit; font-size: .88rem; font-weight: 650;
  padding: 7px 13px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--ink);
}
.tags.pick .tag { cursor: pointer; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); transition: all .15s ease; }
.tags.pick .tag[aria-pressed="true"] { background: var(--ink); color: var(--paper); box-shadow: none; }
.add-tag { display: flex; gap: 8px; margin-top: 10px; }
.add-tag input { flex: 1; }
.field em { font-style: normal; font-weight: 500; color: var(--muted); }
.person-sheet { text-align: center; }
.person-sheet .avatar { margin: 8px auto 16px; }
.person-sheet h2 { padding: 0; }
.person-sheet h3 { font-size: .95rem; margin: 22px 0 4px; }
.person-sheet .tags { justify-content: center; }
.person-sheet .bio { font-size: 1.05rem; margin: 16px auto 0; max-width: 40ch; }

/* Elegir foto */
.photo-pick { display: flex; align-items: center; gap: 16px; margin: 4px 0 20px; }
.photo-btn { cursor: pointer; }
.photo-preview {
  width: 84px; height: 84px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--paper-2); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.photo-pick small { display: block; color: var(--muted); font-size: .85rem; }
.photo-actions { display: flex; gap: 14px; }

/* Opciones del calendario */
.options { display: grid; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; border: 0; cursor: pointer;
  padding: 14px 14px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  text-decoration: none; color: var(--ink); font: inherit; transition: transform .12s ease, box-shadow .2s ease;
}
.option:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.option:active { transform: scale(.98); }
.option > span:nth-child(2) { flex: 1; }
.option b { display: block; font-weight: 700; }
.option small { display: block; color: var(--muted); font-size: .84rem; }
.option > svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.option-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; }
.option-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.option-icon.g { background: #1A73E8; }
.option-icon.o { background: #0F6CBD; }
.option-icon.i { background: #1F1D24; }
.option-icon.m { background: var(--ok); }

.profile .box p { color: var(--ink); }
.profile .box p .muted, .profile .box .fine { color: var(--muted); }
.att-count { font-size: .98rem; }
.joined-line { white-space: nowrap; font-size: 1rem; }
.photo-pick > div { padding-right: 36px; }
.actions .row .btn-ghost.small { padding: 9px 13px; }

/* ── Botones con degradado ──────────────── */
.btn { background: var(--grad); background-size: 140% 100%; background-position: 0% 50%; color: #fff;
  box-shadow: 0 12px 26px -12px rgba(106, 59, 209, .75), inset 0 1px 0 rgba(255,255,255,.22);
  transition: transform .12s ease, background-position .4s ease, filter .2s ease; }
.btn:hover { background-position: 100% 50%; filter: none; }
.btn-ghost { background: var(--grad-soft); box-shadow: inset 0 0 0 1px var(--line), 0 6px 16px -12px rgba(15,40,25,.35); }
.btn-ghost:hover { background: var(--grad-soft); box-shadow: inset 0 0 0 1.5px var(--ink); }
.chip { background: var(--grad-soft); }
.chip[aria-pressed="true"], .tags.pick .tag[aria-pressed="true"] { background: var(--grad-deep); color: var(--paper); }
.tabbar a[aria-current="page"] { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(106,59,209,.8); }
.tabbar { background: color-mix(in srgb, var(--card) 80%, transparent); }
.badge.joined { background: var(--grad); }
.joined-line .tick { background: var(--grad-ok); }
.option-icon.g { background: linear-gradient(135deg, #1A73E8, #34A0F5); }
.option-icon.o { background: linear-gradient(135deg, #0F4C9E, #2B8BE0); }
.option-icon.i { background: linear-gradient(135deg, #1F1D24, #4A4752); }
.option-icon.m { background: var(--grad-ok); }
.meter span { background: var(--grad); }
.notice, .box, .option { background: var(--card); }
.tag { background: color-mix(in srgb, #6A3BD1 12%, var(--card)); }
.face, .avatar.xs { border-color: var(--paper); }

/* ── Chat del plan ──────────────────────── */
.chat-teaser { margin: 22px 0 6px; padding: 18px; border-radius: 22px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 12px; }
.chat-teaser-head { display: flex; align-items: center; gap: 12px; }
.chat-teaser-head small { display: block; color: var(--muted); font-size: .88rem; }
.chat-teaser p { margin: 0; }
.chat-teaser .btn, .chat-teaser .btn-ghost { width: 100%; }
.chat-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; flex: none; }
.chat-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.chat-icon.big { width: 58px; height: 58px; border-radius: 20px; margin: 0 auto 12px; }
.chat-icon.big svg { width: 28px; height: 28px; }
.btn-ghost.wa svg { color: #1FA855; }

.chat-sheet[open] { height: 94vh; height: 94dvh; }
@media (min-width: 700px) { .chat-sheet[open] { height: 86vh; } }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line);
  background: var(--card); position: relative;
}
.chat-head::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--pig); }
.sheet-close.inline { position: static; flex: none; background: var(--paper-2); color: var(--ink); width: 38px; height: 38px; }
.chat-title { flex: 1; min-width: 0; }
.chat-title b { display: block; font: 720 1.05rem/1.2 var(--display); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title small { color: var(--muted); font-size: .82rem; }
.chat-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 14px 14px; background: var(--paper); }
.chat-list { display: flex; flex-direction: column; gap: 3px; max-width: 640px; margin: 0 auto; }
.chat-empty { text-align: center; color: var(--muted); padding: 40px 20px; margin: auto; max-width: 34ch; }
.chat-empty b { color: var(--ink); }
.chat-day { align-self: center; margin: 14px 0 8px; font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--card); padding: 4px 12px; border-radius: 99px; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; }
.msg.first { margin-top: 8px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 32px; flex: none; }
.avatar.sm { --size: 32px; }
.org-avatar { background: var(--grad); font-size: .9rem; }
.plain { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; }
.bubble { background: var(--card); padding: 8px 12px 6px; border-radius: 18px 18px 18px 6px; box-shadow: 0 1px 1px rgba(15,40,25,.08); min-width: 60px; }
.msg:not(.first) .bubble { border-radius: 18px 18px 18px 18px; }
.msg.mine .bubble { background: var(--grad); color: #fff; border-radius: 18px 18px 6px 18px; }
.msg.org .bubble { background: color-mix(in srgb, #6A3BD1 10%, var(--card)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, #6A3BD1 35%, transparent); }
.msg-name { display: block; font-size: .78rem; font-weight: 800; color: var(--accent); margin-bottom: 1px; }
.msg.org .msg-name { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.msg-text { display: block; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.msg-meta { display: block; text-align: right; font-size: .7rem; opacity: .65; margin-top: 2px; }
.msg-del { text-decoration: underline; margin-left: 6px; font-size: .7rem; color: inherit; }
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--card); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; resize: none; font: inherit; font-size: 16px; color: inherit; background: var(--paper-2);
  border: 0; border-radius: 22px; padding: 11px 16px; max-height: 140px; line-height: 1.35;
}
.composer textarea:focus { outline: 2px solid var(--accent); }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 8px 18px -10px rgba(106,59,209,.9); }
.send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.send:active { transform: scale(.94); }

/* ── Creador de avatar ──────────────────── */
.avatar.drawn { background: none; }
.avatar.drawn svg { width: 100%; height: 100%; display: block; }
.av-builder { background: var(--card); border-radius: 22px; padding: 16px; margin: 4px 0 20px; box-shadow: inset 0 0 0 1px var(--line); }
.av-top { display: flex; align-items: center; gap: 16px; }
.av-top b { display: block; font-size: 1.02rem; }
.av-top small { display: block; color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.av-preview { --size: 96px; box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--line); }
.av-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 12px; }
.av-tabs::-webkit-scrollbar { display: none; }
.av-tabs .chip { padding: 7px 13px; font-size: .86rem; }
.av-panel { min-height: 92px; }
.av-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.av-opt { border: 0; background: none; padding: 4px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; color: inherit; }
.av-mini { width: 58px; height: 58px; border-radius: 50%; overflow: hidden; display: block; box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s ease, transform .15s ease; }
.av-mini svg { width: 100%; height: 100%; display: block; }
.av-opt[aria-pressed="true"] .av-mini { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px #6A3BD1; }
.av-opt:active .av-mini { transform: scale(.94); }
.av-opt small { font-size: .74rem; font-weight: 650; color: var(--muted); }
.av-opt[aria-pressed="true"] small { color: var(--ink); }
.av-panel .swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .12s ease; }
.swatch:active { transform: scale(.92); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px #6A3BD1; }
input[type="date"] { min-height: 52px; }

/* ── Tipografía: Plus Jakarta Sans ──────── */
body { letter-spacing: 0; }
.brand h1 { font-weight: 800; letter-spacing: -0.035em; line-height: .95; }
.brand p { font-weight: 500; }
.overlay h2, .hero .overlay h2, .card.featured .overlay h2 { font-weight: 800; letter-spacing: -0.01em; }
.card.featured .overlay h2 { letter-spacing: -0.015em; line-height: 1.02; }
.section-title, .empty h2, .form h2, .profile-head h2 { font-weight: 800; letter-spacing: -0.025em; }
.chip, .tabbar a { font-weight: 650; }
.btn { font-weight: 700; }
.date-blob .d { font-weight: 800; letter-spacing: -0.04em; }
.att-count b { font-weight: 800; letter-spacing: -0.03em; }
.field span, .box h3 { font-weight: 700; }
.chat-title b, .msg-name { letter-spacing: 0; }

/* ── Campanita de avisos ────────────────── */
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.bell {
  position: relative; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; flex: none;
  display: grid; place-items: center; color: var(--ink);
  background: color-mix(in srgb, var(--card) 70%, transparent); box-shadow: inset 0 0 0 1px var(--line);
  transition: background .2s ease, transform .12s ease;
}
.bell:hover { background: var(--card); }
.bell:active { transform: scale(.94); }
.bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell-dot {
  position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: #E5484D; box-shadow: 0 0 0 2px var(--paper); transform: scale(0); transition: transform .25s cubic-bezier(.3,1.6,.5,1);
}
.bell.has-unread .bell-dot { transform: scale(1); }
.bell.ring svg { animation: ring .9s ease; transform-origin: 50% 15%; }
@keyframes ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } 75% { transform: rotate(2deg); } }

.notif-sheet h2 { margin-bottom: 14px; }
.notif-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.notif {
  width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 0; cursor: pointer;
  padding: 12px; border-radius: 18px; background: transparent; color: var(--ink); font: inherit; transition: background .15s ease;
}
.notif:hover { background: var(--card); }
.notif.unread { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.notif-icon { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; background: var(--grad); }
.notif-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.notif-icon.k-chat { background: linear-gradient(135deg, #0E7490, #2BA3C4); }
.notif-icon.k-change { background: linear-gradient(135deg, #B07A0C, #E8A21C); }
.notif-icon.k-cancel, .notif-icon.k-leave { background: linear-gradient(135deg, #9A2A22, #D9534A); }
.notif-icon.k-paid, .notif-icon.k-signup { background: var(--grad-ok); }
.notif-icon.k-member { background: linear-gradient(135deg, #7A3A8E, #C2357F); }
.notif-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.notif-text b { font-weight: 700; font-size: .95rem; line-height: 1.3; }
.notif-text span { color: var(--muted); font-size: .9rem; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-text small { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.notif-new { width: 9px; height: 9px; border-radius: 50%; background: #E5484D; flex: none; margin-top: 6px; }
.notif-empty { text-align: center; padding: 28px 8px 8px; color: var(--muted); }
.notif-empty p { max-width: 32ch; margin: 0 auto 14px; }
.notif-empty-icon { width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--card); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.notif-empty-icon svg, .push-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.push-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 18px; margin-bottom: 4px;
  background: color-mix(in srgb, #6A3BD1 9%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #6A3BD1 22%, transparent); }
.push-card.on { background: color-mix(in srgb, var(--ok) 11%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 25%, transparent); }
.push-card.muted { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.push-card p { margin: 0; font-size: .9rem; line-height: 1.4; }
.push-card .link-btn { padding: 4px 0 0; }
.push-icon { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; flex: none; color: #fff; background: var(--grad); }
.push-card.on .push-icon { background: var(--grad-ok); }
.push-card.muted .push-icon { background: var(--paper-2); color: var(--muted); }
.push-icon svg { width: 20px; height: 20px; }
.btn.small-btn { min-height: 0; padding: 9px 16px; font-size: .9rem; margin-top: 10px; }

/* Mostrar / ocultar contraseña */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--ink); background: var(--paper-2); }
.pw-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field .pw-wrap { margin: 0; font-weight: inherit; font-size: inherit; }

/* ── Privacidad del perfil ──────────────── */
.switch-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 6px 0 4px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.switch-row > span:first-child { flex: 1; }
.switch-row b { display: block; font-weight: 700; }
.switch-row small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.35; margin-top: 2px; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { position: relative; width: 50px; height: 30px; border-radius: 99px; background: var(--line); flex: none; transition: background .2s ease; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s cubic-bezier(.3,1.4,.5,1); }
.switch-row input:checked + .switch { background: var(--grad); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--accent); outline-offset: 2px; }
.privacy-pill { display: inline-block; margin-top: 8px; padding: 5px 11px; border-radius: 99px; font-size: .8rem; font-weight: 650; background: color-mix(in srgb, var(--ok) 13%, var(--card)); color: var(--ink); }
.privacy-pill.private { background: var(--paper-2); }
