/* ---------- Capas: drawer, modal, popover ---------- */
#layers { position: relative; z-index: 60; }
.layer { position: fixed; inset: 0; z-index: 60; }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .35s ease; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.layer.open .scrim { opacity: 1; }
.layer.pop-layer .scrim { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(104%); transition: transform .55s var(--ease);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.layer.open .drawer { transform: none; }
.modal {
  position: absolute; left: 50%; top: 50%; width: min(580px, calc(100% - 32px)); max-height: min(88dvh, 800px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .45s var(--ease), opacity .3s;
}
.layer.open .modal { transform: translate(-50%, -50%); opacity: 1; }
.modal.wide { width: min(760px, calc(100% - 32px)); }
.palette { top: max(9vh, calc(16px + env(safe-area-inset-top, 0px))); transform: translate(-50%, -12px) scale(.98); }
.layer.open .palette { transform: translate(-50%, 0); }
.pop { position: absolute; top: calc(70px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); width: min(400px, calc(100% - 32px)); max-height: 70dvh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); transform: translateY(-8px) scale(.98); transform-origin: top right; opacity: 0; transition: transform .35s var(--ease), opacity .25s; }
.layer.open .pop { transform: none; opacity: 1; }
.m-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; background: var(--surface); }
.m-head h2 { font-size: 22px; letter-spacing: -.03em; }
.m-body { padding: 0 20px 20px; display: grid; gap: 16px; }
.m-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.m-foot .fine { flex: 1 1 200px; }

.d-hero { position: relative; padding: 22px 22px 20px; display: grid; gap: 14px; overflow: hidden; isolation: isolate; }
.d-hero::before { content: ""; position: absolute; inset: 0 0 auto; height: 120px; z-index: -1; background: radial-gradient(80% 120% at 20% 0%, hsl(var(--h, 220) 80% 62% / .3), transparent 70%), radial-gradient(60% 100% at 90% 0%, hsl(calc(var(--h, 220) + 50) 80% 60% / .22), transparent 70%); }
.d-close { position: absolute; top: 14px; right: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.d-id { display: flex; gap: 16px; align-items: center; margin-top: 18px; min-width: 0; }
.d-id > div { min-width: 0; }
.d-id h2 { font-size: 28px; letter-spacing: -.035em; }
.d-id p { color: var(--muted); }
.d-sec { padding: 18px 22px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.d-sec h3 { font-family: var(--f-mono); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.d-sec p { font-size: 15px; color: var(--ink-2); }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.d-cover { aspect-ratio: 21 / 9; }
.d-cover .cover-glyph { font-size: clamp(80px, 12vw, 130px); }
.stage-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stage-track div { display: grid; gap: 7px; font-size: 12.5px; color: var(--muted); }
.stage-track i { height: 6px; border-radius: 999px; background: var(--bg-2); position: relative; overflow: hidden; }
.stage-track .done i::after, .stage-track .cur i::after { content: ""; position: absolute; inset: 0; background: var(--door); transform-origin: left; animation: fillx .9s var(--ease) both; animation-delay: calc(var(--i) * .15s); }
.stage-track .cur { color: var(--ink); font-weight: 600; }
@keyframes fillx { from { transform: scaleX(0); } }
.team-list { display: grid; gap: 10px; }
.team-row { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.team-row small { display: block; color: var(--muted); font-size: 12.5px; }
.timeline { list-style: none; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--door); margin-top: 6px; box-shadow: 0 0 0 4px var(--door-soft); }
.timeline li::after { content: ""; position: absolute; left: 4px; top: 18px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline small { color: var(--muted); font-size: 12px; display: block; }
.attendee-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.attendee { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; cursor: pointer; }

/* Paleta */
.pal-in { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pal-in .ic { color: var(--faint); width: 20px; height: 20px; }
.pal-in input { flex: 1; min-width: 0; height: 36px; border: 0; outline: none; background: transparent; font-size: 17px; color: var(--ink); }
.pal-res { padding: 8px; max-height: min(60dvh, 520px); overflow-y: auto; }
.pal-group { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 6px; }
.pal-item { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 12px; text-align: left; }
.pal-item b { font-size: 14px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item small { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item.on, .pal-item:hover { background: var(--bg-2); }
.pal-item .tdot { width: 32px; height: 32px; }
.pal-item kbd { visibility: hidden; }
.pal-item.on kbd { visibility: visible; }
.pal-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 14px; }

/* Notificaciones */
.notif { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px 16px; text-align: left; width: 100%; transition: background-color .2s; }
.notif:hover { background: var(--surface-2); }
.notif p { font-size: 14px; color: var(--ink-2); }
.notif small { color: var(--muted); font-size: 12px; }

/* Compose */
.type-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.type-pick legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.tp { position: relative; cursor: pointer; }
.tp input { position: absolute; opacity: 0; pointer-events: none; }
.tp > span { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px 0 6px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 13px; font-weight: 500; color: var(--ink-2); transition: all .2s var(--ease); }
.tp .tdot { width: 24px; height: 24px; border-radius: 8px; }
.tp .tdot .ic { width: 13px; height: 13px; }
.tp input:checked + span { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.tp input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.count { font-family: var(--f-mono); font-size: 12px; color: var(--faint); }

/* Onboarding */
.ob-progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 20px; }
.ob-progress i { height: 4px; border-radius: 999px; background: var(--bg-2); overflow: hidden; position: relative; }
.ob-progress i.on::after { content: ""; position: absolute; inset: 0; background: var(--door); animation: fillx .6s var(--ease) both; }
.ob-doors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ob-door { position: relative; cursor: pointer; }
.ob-door input { position: absolute; opacity: 0; pointer-events: none; }
.ob-door > span { display: grid; gap: 6px; align-content: end; min-height: 150px; padding: 14px; border-radius: 18px; border: 2px solid transparent; transition: transform .35s var(--ease), border-color .2s, box-shadow .3s; overflow: hidden; position: relative; isolation: isolate; }
.ob-door b { font-family: var(--f-display); font-size: 20px; letter-spacing: -.03em; line-height: 1; }
.ob-door small { font-size: 12.5px; line-height: 1.35; }
.ob-door.d-founders > span { color: var(--day-ink); background: linear-gradient(180deg, var(--day-1), var(--day-3) 80%, var(--day-4)); }
.ob-door.d-underground > span { color: var(--night-ink); background: radial-gradient(130% 90% at 80% 0%, var(--night-1), var(--night-2) 50%, var(--night-3)); }
.ob-door.d-underground b { font-family: var(--f-mono); text-transform: uppercase; font-size: 16px; }
.ob-door.d-both > span { color: var(--night-ink); background: linear-gradient(100deg, var(--day-4) 0%, #B5547A 45%, var(--night-2) 100%); }
.ob-door input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 4px var(--door-soft); transform: translateY(-3px); }
.ob-door input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.ob-step { display: grid; gap: 16px; animation: swap .5s var(--ease); }
.ob-step h3 { font-size: 26px; letter-spacing: -.035em; }

/* Celebración */
.celebrate { position: relative; padding: 36px 26px 28px; display: grid; justify-items: center; text-align: center; gap: 12px; overflow: hidden; }
.celebrate canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.celebrate h2 { font-size: 32px; letter-spacing: -.04em; }
.celebrate p { color: var(--muted); max-width: 36ch; }
.badge-big { width: 112px; height: 126px; animation: badge-in 1.1s var(--spring) both; margin-bottom: 8px; }
.badge-big .ic { width: 46px; height: 46px; }
@keyframes badge-in { 0% { transform: rotateY(180deg) scale(.3); opacity: 0; } 60% { transform: rotateY(-20deg) scale(1.08); opacity: 1; } 100% { transform: none; } }

/* Toasts */
.toasts { position: fixed; z-index: 80; right: max(18px, env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px 12px 12px; border-radius: 16px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; animation: toast-in .5s var(--spring) both; }
.toast .tdot { background: rgba(127, 127, 127, .22); color: inherit; }
.toast.out { animation: toast-out .35s var(--ease) forwards; }
@keyframes toast-in { from { transform: translateY(16px) scale(.96); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(10px); opacity: 0; } }

/* ---------- Menú del celular (landing) y hoja «Más» (app) ---------- */
.menu-btn { display: none; }
.menu-sheet { width: min(420px, calc(100% - 32px)); }
.menu-list { display: grid; padding: 0 12px 8px; }
.menu-link { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 10px; border-radius: 14px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); text-align: left; }
.menu-link .ic { width: 18px; height: 18px; color: var(--faint); }
.menu-link:hover, .menu-link:focus-visible { background: var(--bg-2); }
.menu-foot { display: grid; gap: 8px; padding: 14px 20px calc(20px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.menu-foot .btn { width: 100%; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 16px 16px; }
.more-item { display: grid; justify-items: center; gap: 8px; padding: 16px 6px 14px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: center; transition: background-color .2s, border-color .2s, transform .2s var(--ease); }
.more-item .ic { width: 24px; height: 24px; color: var(--door-ink); }
.more-item.on { border-color: var(--door); background: var(--door-soft); color: var(--door-ink); }
.more-item:active { transform: scale(.96); }
