/* Nido — "dos tintas": cada persona del nido escribe con su color; el resto de la interfaz es papel salvia. */
@font-face { font-family: "Archivo"; src: url("/fonts/archivo-wdth.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("/fonts/atkinson.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --paper: #eef1ec;
  --surface: #ffffff;
  --surface-2: #f5f7f4;
  --ink: #16201c;
  --ink-2: #3a4540;
  --muted: #67716c;
  --line: #dce1da;
  --ink-a: #2b50e0;   /* Cobalto: primera persona del nido */
  --ink-b: #c2185b;   /* Granada: segunda persona */
  --ink-c: #0e8a6a;
  --ink-d: #b26b00;
  --me: var(--ink-a); /* tinta de quien usa la app; app.js la fija */
  --danger: #b42318;
  --ok: #18794e;
  --shadow: 0 1px 0 var(--line), 0 12px 28px -22px rgb(22 32 28 / .45);
  --radius: 18px;
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Atkinson Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1210;
    --surface: #151c19;
    --surface-2: #1b2420;
    --ink: #e7ede8;
    --ink-2: #c3ccc6;
    --muted: #8f9b95;
    --line: #26302b;
    --ink-a: #8098ff;
    --ink-b: #f2709c;
    --ink-c: #4cc9a4;
    --ink-d: #f0a640;
    --danger: #ff8a80;
    --ok: #5ad19a;
    --shadow: 0 1px 0 var(--line), 0 16px 30px -24px rgb(0 0 0 / .9);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
img, video { max-width: 100%; }
:focus-visible { outline: 2px solid var(--me); outline-offset: 2px; border-radius: 8px; }
.icon { flex: none; vertical-align: middle; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 7vw, 2.4rem); font-weight: 800; font-stretch: 118%; line-height: 1; }
h2 { font-size: 1.12rem; font-weight: 700; font-stretch: 110%; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.mono { font-family: var(--mono); font-size: .82em; letter-spacing: -.01em; }
.center { text-align: center; }
.error { color: var(--danger); min-height: 1em; margin: 0; font-size: .9rem; }
.ok-line { margin: 0; color: var(--ok); font-weight: 700; }

/* ---------- layout ---------- */
.wrap { max-width: 620px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.narrow { max-width: 420px; margin: 0 auto; }
.stack > * + * { margin-top: 12px; }
.stack-sm > * + * { margin-top: 6px; }
.page > * + * { margin-top: 14px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.pad { padding: 16px; }

/* ---------- controls ---------- */
input, textarea, select {
  width: 100%; font: inherit; color: inherit;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; transition: border-color .15s, background .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--me); background: var(--surface); }
button, .button {
  font: 600 .95rem/1 var(--body); cursor: pointer; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; transition: transform .12s ease, background .15s, border-color .15s, color .15s;
}
button:active, .button:active { transform: scale(.96); }
button:disabled { opacity: .5; }
.primary, a.button.primary { background: var(--me); border-color: var(--me); color: #fff; }
.big { width: 100%; padding: 15px; font-size: 1.02rem; }
.link { background: none; border: 0; color: var(--me); padding: 6px 0; }
.ghost { background: transparent; border-color: transparent; }

/* ---------- app bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; margin: 0 -16px 6px;
  background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(14px);
}
.appbar .who { flex: 1; min-width: 0; }
.appbar .nest { font: 700 .98rem/1.1 var(--display); font-stretch: 112%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .sub { font-size: .78rem; color: var(--muted); }
.appbar button { padding: 9px; }

.pair { display: flex; }
.avatar {
  --c: var(--ink-a);
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--c); color: #fff; font: 800 .82rem/1 var(--display); font-stretch: 120%;
  box-shadow: 0 0 0 2px var(--paper);
}
.pair .avatar + .avatar { margin-left: -9px; }
.avatar.sm { width: 22px; height: 22px; font-size: .62rem; box-shadow: none; }

.page-title { padding: 10px 0 2px; }
.page-title p { margin: 6px 0 0; color: var(--muted); }

/* ---------- segmented filters ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { white-space: nowrap; padding: 9px 14px; font-size: .88rem; background: transparent; }
.tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.who-filter { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); width: fit-content; }
.who-filter button { border: 0; background: none; padding: 6px 12px 6px 6px; font-size: .86rem; gap: 8px; }
.who-filter button.on { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.who-filter .avatar.sm + .avatar.sm { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }

/* ---------- feed cards ---------- */
.feed { display: grid; gap: 14px; }
.item { position: relative; }
.item .byline { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; font-size: .86rem; }
.item .byline b { font-weight: 700; }
.item .byline .when-ago { color: var(--muted); }
.kind-tag {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--muted);
  font: 500 .74rem/1 var(--mono); text-transform: uppercase; letter-spacing: .04em;
}
.thumb { position: relative; display: block; margin: 0 10px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.thumb img { display: block; width: 100%; max-height: 460px; object-fit: cover; }
.video-wrap { background: #000; cursor: pointer; }
.video-wrap video { display: block; width: 100%; max-height: 74vh; object-fit: contain; }
.chip-over {
  position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; background: rgb(0 0 0 / .55); color: #fff; font-size: .78rem;
  backdrop-filter: blur(6px); pointer-events: none;
}
.chip-over.left { right: auto; left: 10px; }
.item .body { padding: 12px 16px 6px; }
.item .body > * + * { margin-top: 6px; }
.item .title {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font: 700 1.06rem/1.25 var(--display); font-stretch: 104%; text-decoration: none; margin: 0;
}
.item .desc { color: var(--muted); font-size: .92rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .note {
  margin: 0; padding: 8px 12px; border-radius: 4px 14px 14px 14px; font-size: .95rem;
  background: color-mix(in srgb, var(--c, var(--me)) 10%, var(--surface)); border-left: 3px solid var(--c, var(--me));
}
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 500 .8rem/1.3 var(--mono); color: var(--ink-2); margin: 0; }
.meta-row .when { color: var(--me); }
.price { font: 700 1.05rem/1 var(--mono); }

.actions { display: flex; align-items: center; gap: 2px; padding: 4px 8px 10px; }
.actions button, .actions a {
  background: none; border: 0; padding: 9px 10px; color: var(--ink-2); font-size: .82rem; gap: 6px; border-radius: 12px;
}
.actions button:hover, .actions a:hover { background: var(--surface-2); }
.actions .on { color: var(--me); }
.actions .spacer { flex: 1; }
.actions .liked .icon path { fill: currentColor; }
.scheduler { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 14px; }
.scheduler input { flex: 1 1 200px; }
.scheduler[hidden] { display: none; }

/* overflow menu */
.menu { position: absolute; right: 12px; bottom: 54px; z-index: 3; min-width: 210px; padding: 6px; display: grid; gap: 2px; }
.menu[hidden] { display: none; }
.menu button, .menu a { justify-content: flex-start; border: 0; background: none; border-radius: 10px; padding: 10px 12px; font-weight: 500; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu .label { font: 500 .72rem/1 var(--mono); text-transform: uppercase; color: var(--muted); padding: 8px 12px 4px; }
.menu .current { color: var(--me); }

/* add box */
.add-box summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 700; }
.add-box summary::-webkit-details-marker { display: none; }
.add-box summary .icon { color: var(--me); }
.add-box[open] summary { padding-bottom: 6px; }
.add { display: grid; gap: 10px; padding: 0 16px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* skeletons */
.skeleton { height: 280px; background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.empty { padding: 36px 12px; color: var(--muted); text-align: center; }
.sentinel { min-height: 40px; }

/* ---------- agenda / pendientes rows ---------- */
.day h2 { font: 600 .78rem/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 4px 8px; }
.day h2.late { color: var(--danger); }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row-time { flex: 0 0 64px; font: 500 .8rem/1.2 var(--mono); color: var(--muted); }
.row-main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.row-main .t { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; }
.row-main .t .icon { color: var(--muted); }
.check {
  flex: 0 0 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 2px solid var(--line); background: transparent; color: transparent;
}
.check:hover, .check:active { border-color: var(--me); color: var(--me); }
button.danger { color: var(--muted); background: none; border: 0; padding: 8px; }

/* ---------- bottom navigation ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(6, 1fr); max-width: 620px; margin: 0 auto;
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0 4px; color: var(--muted); text-decoration: none; font-size: .66rem; font-weight: 600;
}
.bottom-nav a.on { color: var(--ink); }
.bottom-nav a.on::before { content: ""; position: absolute; top: -7px; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--me); }
.bottom-nav a.on .icon { color: var(--me); }

/* ---------- sheet (settings) ---------- */
dialog.sheet {
  border: 0; padding: 0 0 env(safe-area-inset-bottom); margin: auto auto 0; width: 100%; max-width: 620px; max-height: 88vh;
  inset-inline: 0;
  background: var(--surface); color: var(--ink); border-radius: 22px 22px 0 0;
}
dialog.sheet::backdrop { background: rgb(10 14 12 / .45); }
dialog.sheet[open] { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
.sheet .handle { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 10px auto 4px; }
.sheet section { padding: 14px 18px; }
.sheet section + section { border-top: 1px solid var(--line); }
.sheet h3 { font: 600 .76rem/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.code { font: 700 1.3rem/1 var(--mono); letter-spacing: .08em; }
.members { display: flex; flex-wrap: wrap; gap: 10px; }
.member { display: flex; align-items: center; gap: 8px; font-weight: 600; }

/* ---------- auth / share ---------- */
.brand { padding-top: 48px; }
.brand img { width: 76px; height: 76px; border-radius: 22px; }
.brand h1 { margin-top: 14px; }
.brand p { margin: 8px 0 0; }
.or { margin: 0; font-size: .86rem; }
.button.sso { width: 100%; padding: 15px; }
.download { display: flex; align-items: center; gap: 12px; text-decoration: none; padding: 14px 16px; }
.download span { display: block; }
.shared-text { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; overflow-wrap: anywhere; font-size: .9rem; margin: 0; }
.done-mark { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--me); color: #fff; }

.push-prompt { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.push-prompt p { margin: 0; flex: 1; font-size: .92rem; }
.push-prompt .icon { color: var(--me); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.previews img, .video-tile { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.video-tile { display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--muted); font-size: .8rem; }
.bell-off { position: relative; color: var(--me); }
.bell-off::after { content: ""; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--paper); }

/* settings: switches and pref rows */
.switch, .pref-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0; }
.switch > span, .pref-row > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.switch input { appearance: none; flex: none; width: 46px; height: 28px; padding: 0; border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked { background: var(--me); }
.switch input:checked::after { transform: translateX(18px); }
.pref-row select { width: auto; padding: 8px 10px; }
.hours { display: flex; align-items: center; gap: 6px; flex: none; }

/* conversation under a post */
.thread { border-top: 1px solid var(--line); padding: 12px 16px 14px; display: grid; gap: 10px; }
.comments { display: grid; gap: 10px; }
.comment { display: flex; align-items: flex-start; gap: 8px; }
.comment .avatar { margin-top: 4px; }
.comment .bubble { flex: 1; min-width: 0; background: var(--surface-2); border-radius: 4px 14px 14px 14px; padding: 8px 12px; overflow-wrap: anywhere; }
.comment .bubble p { margin: 0; }
.comment .who { font-size: .8rem; margin-bottom: 2px !important; }
.comment .danger { padding: 6px; }
.composer { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { resize: none; min-height: 44px; max-height: 140px; field-sizing: content; }
.composer button { flex: none; padding: 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: .9rem; padding: 4px 0; }

/* tap-to-load official player */
.facade { width: calc(100% - 20px); padding: 0; border: 0; cursor: pointer; display: block; text-align: initial; }
.facade img { display: block; width: 100%; max-height: 460px; object-fit: cover; filter: saturate(.9); }
.facade-blank { display: grid; place-items: center; height: 220px; color: var(--muted); background: var(--surface-2); }
.facade-cta {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: 0 8px 24px -8px rgb(0 0 0 / .5);
}
.embed iframe { display: block; width: 100%; border: 0; background: #000; }
.embed.youtube iframe { aspect-ratio: 16 / 9; }
.embed.instagram iframe { height: min(78vh, 640px); background: #fff; }
.embed.tiktok iframe { height: min(78vh, 740px); }
.embed-slot { height: min(78vh, 640px); }
.embed { overflow: hidden; }
.embed.instagram iframe { border-radius: 12px; }

.mention { color: var(--c, var(--me)); font-weight: 700; }
.mention-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.mention-picker[hidden] { display: none; }
.mention-picker button { padding: 6px 12px 6px 6px; font-size: .88rem; }
