/* ==========================================================
   Cuadrilla — cuaderno de recuerdos: papel, tinta y pegatinas
   ========================================================== */
:root {
	--paper: #F3EDE2;
	--paper2: #E8DFCD;
	--card: #FFFCF6;
	--ink: #1A1813;
	--ink2: #57503F;
	--mute: #8C8475;
	--accent: #FF5A36;
	--lime: #D4F06A;
	--sky: #A9D6F5;
	--sun: #FFD166;
	--wa: #25D366;
	--pos: #178A5B;
	--neg: #D0392A;
	--r: 18px;
	--r-sm: 12px;
	--sh: 3px 3px 0 var(--ink);
	--sh-lg: 5px 5px 0 var(--ink);
	--f-display: 'Bricolage Grotesque', Georgia, serif;
	--f-body: 'Figtree', system-ui, sans-serif;
	--f-hand: 'Caveat', cursive;
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.cq {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font: 16px/1.45 var(--f-body);
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}
body.cq::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	opacity: .55;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .09 0 0 0 0 .07 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.noscroll { overflow: hidden; }
img { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); letter-spacing: -.02em; margin: 0; line-height: 1.05; }
.hidden { display: none !important; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.cq-app {
	position: relative;
	z-index: 1;
	max-width: 560px;
	margin: 0 auto;
	min-height: 100vh;
	padding-bottom: calc(110px + var(--safe-b));
}
@media (min-width: 760px) {
	body.cq { background: var(--paper2) radial-gradient(var(--ink) .8px, transparent .8px) 0 0/18px 18px; }
	.cq-app { background: var(--paper); border-inline: 2px solid var(--ink); box-shadow: 10px 0 0 var(--ink); }
}

/* ---------- Logo ---------- */
.logo-mark {
	font: 800 30px/1 var(--f-display);
	letter-spacing: -.04em;
	text-transform: lowercase;
}
.logo-mark::after { content: "."; color: var(--accent); }
.logo-mark.sm { font-size: 22px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .logo-mark { animation: pulse 1.2s ease-in-out infinite; }

/* ---------- Topbar ---------- */
.topbar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: calc(12px + var(--safe-t)) 16px 12px;
	min-height: 64px;
}
.topbar .crumb { flex: 1; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
	width: 42px; height: 42px;
	display: inline-grid; place-items: center;
	border: 2px solid var(--ink);
	border-radius: 50%;
	background: var(--card);
	color: var(--ink);
	font-size: 20px; font-weight: 800;
	text-decoration: none;
	cursor: pointer;
	flex: none;
	box-shadow: 2px 2px 0 var(--ink);
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.icon-btn.sm { width: 30px; height: 30px; font-size: 16px; box-shadow: none; border-width: 1.5px; }
.av-btn { border: 0; background: none; padding: 0; cursor: pointer; }

/* ---------- Botones ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .45em;
	padding: 12px 18px;
	font: 700 15px/1 var(--f-body);
	border: 2px solid var(--ink);
	border-radius: 999px;
	background: var(--card);
	color: var(--ink);
	box-shadow: var(--sh);
	cursor: pointer;
	text-decoration: none;
	transition: transform .12s, box-shadow .12s;
	white-space: nowrap;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-lime { background: var(--lime); }
.btn-sun { background: var(--sun); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; }
.btn-danger { background: transparent; box-shadow: none; color: var(--neg); border-color: var(--neg); }
.btn-sm { padding: 8px 13px; font-size: 13px; box-shadow: 2px 2px 0 var(--ink); }
.btn-block { width: 100%; margin-top: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; cursor: pointer; font-size: inherit; }

.fab {
	position: fixed;
	z-index: 20;
	bottom: calc(22px + var(--safe-b));
	right: max(18px, calc(50vw - 262px));
	padding: 16px 22px;
	font: 800 16px/1 var(--f-body);
	background: var(--accent);
	color: #fff;
	border: 2px solid var(--ink);
	border-radius: 999px;
	box-shadow: var(--sh-lg);
	cursor: pointer;
	animation: pop .5s .2s cubic-bezier(.3, 1.6, .5, 1) both;
}
.fab:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- Chips, avatares ---------- */
.chip {
	display: inline-flex; align-items: center; gap: 5px;
	padding: 5px 10px;
	font-size: 12px; font-weight: 700;
	border: 1.5px solid currentColor;
	border-radius: 999px;
	white-space: nowrap;
}
.chip-live { color: var(--pos); background: #E4F7EC; border-color: var(--pos); }
.chip-soon { background: var(--sun); color: var(--ink); border-color: var(--ink); }

.av {
	--c: var(--accent);
	width: 34px; height: 34px;
	display: inline-grid; place-items: center;
	flex: none;
	border-radius: 50%;
	background: var(--c);
	color: #fff;
	font: 800 13px/1 var(--f-body);
	border: 2px solid var(--paper);
	outline: 1.5px solid var(--ink);
	outline-offset: -1px;
}
.av.sm { width: 24px; height: 24px; font-size: 10px; border-width: 1.5px; }
.av.lg { width: 52px; height: 52px; font-size: 18px; }
.av-stack { display: inline-flex; align-items: center; }
.av-stack .av + .av { margin-left: -9px; }
.av-stack .more { margin-left: 6px; font-size: 12px; font-weight: 700; color: var(--ink2); }

/* ---------- Cards / páginas ---------- */
.page { padding: 4px 16px 20px; }
.card {
	background: var(--card);
	border: 2px solid var(--ink);
	border-radius: var(--r);
	box-shadow: var(--sh);
	padding: 16px;
	margin: 0 0 14px;
}
.hello { font-size: 38px; font-weight: 800; margin: 6px 0 6px; }
.sub { color: var(--ink2); margin: 0 0 22px; }
.h3 { font-size: 20px; margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 14px; }
.tab-head h2 { font-size: 24px; }
.prose { white-space: pre-line; }
.row { display: flex; align-items: center; gap: 8px; }
.row.gap { gap: 10px; flex-wrap: wrap; }

.empty { text-align: center; padding: 34px 20px; border: 2px dashed rgba(26, 24, 19, .35); border-radius: var(--r); margin: 6px 0 14px; }
.empty .ico { font-size: 42px; display: block; margin-bottom: 8px; }
.empty h3 { font-size: 20px; margin-bottom: 6px; }
.empty p { margin: 0; color: var(--ink2); font-size: 14px; }

/* ---------- Grupos ---------- */
.group-card { display: flex; gap: 14px; align-items: center; text-decoration: none; transition: transform .15s; }
.group-card:active { transform: translate(3px, 3px); box-shadow: none; }
.g-emoji {
	width: 58px; height: 58px; flex: none;
	display: grid; place-items: center;
	font-size: 30px;
	background: var(--gc, var(--accent));
	border: 2px solid var(--ink);
	border-radius: 16px;
	transform: rotate(-4deg);
}
.g-emoji.xl { width: 84px; height: 84px; font-size: 46px; border-radius: 22px; box-shadow: var(--sh); }
.g-body { flex: 1; min-width: 0; }
.g-body h2 { font-size: 21px; margin-bottom: 3px; }
.g-body p { margin: 0 0 7px; color: var(--ink2); font-size: 13px; }

.g-hero { padding: 6px 18px 20px; display: grid; gap: 12px; justify-items: start; }
.g-hero h1 { font-size: 40px; font-weight: 800; text-transform: uppercase; }

.seg {
	display: flex; gap: 4px;
	padding: 4px;
	background: var(--paper2);
	border: 2px solid var(--ink);
	border-radius: 999px;
	margin: 0 0 16px;
}
.seg > button, .seg > label { flex: 1; text-align: center; border: 0; background: none; padding: 9px 10px; border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer; }
.seg > .on, .seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg label { padding: 0; }
.seg label span { display: block; padding: 9px 10px; border-radius: 999px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg b { font-size: 12px; opacity: .7; margin-left: 4px; }
.seg-wide { margin: 0 16px 16px; }

.plan-card { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; position: relative; }
.type-badge {
	width: 48px; height: 48px; flex: none;
	display: grid; place-items: center;
	font-size: 24px;
	background: var(--sun);
	border: 2px solid var(--ink);
	border-radius: 14px;
}
.plan-card small { text-transform: uppercase; letter-spacing: .06em; font-weight: 800; font-size: 11px; color: var(--accent); }
.plan-card h3 { font-size: 20px; margin: 2px 0 4px; }
.plan-card p { margin: 0; font-size: 13px; color: var(--ink2); }
.plan-card .chip { position: absolute; top: 12px; right: 12px; }

/* ---------- Recuerdos (polaroids) ---------- */
.year-h {
	font: 800 64px/1 var(--f-display);
	color: transparent;
	-webkit-text-stroke: 2px var(--ink);
	margin: 22px 0 16px;
}
.polaroids { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; }
.polaroid {
	position: relative;
	display: block;
	background: #fff;
	padding: 8px 8px 12px;
	border: 1px solid rgba(0, 0, 0, .1);
	box-shadow: 0 10px 22px rgba(26, 24, 19, .18);
	transform: rotate(var(--rot, 0deg));
	text-decoration: none;
	color: var(--ink);
	transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.polaroid:hover, .polaroid:active { transform: rotate(0) scale(1.03); }
.polaroid::before {
	content: "";
	position: absolute;
	top: -10px; left: 50%;
	width: 64px; height: 20px;
	background: rgba(255, 209, 102, .8);
	transform: translateX(-50%) rotate(-4deg);
}
.pic { aspect-ratio: 1; background: var(--paper2) center/cover no-repeat; display: grid; place-items: center; font-size: 46px; }
.polaroid p { font: 700 23px/1 var(--f-hand); margin: 9px 2px 3px; }
.polaroid small { font-size: 11px; color: var(--mute); }

/* ---------- Plan ---------- */
.plan-hero {
	position: relative;
	display: flex; flex-direction: column;
	min-height: 330px;
	color: #fff;
	background: var(--ink);
	border-bottom: 2px solid var(--ink);
	overflow: hidden;
}
.plan-hero::before {
	content: "";
	position: absolute; inset: 0;
	background-image: var(--cover, none), linear-gradient(140deg, var(--gc, var(--accent)), #1A1813 90%);
	background-size: cover;
	background-position: center;
}
.plan-hero::after {
	content: "";
	position: absolute; inset: 0;
	background: linear-gradient(180deg, rgba(26, 24, 19, .35) 0%, rgba(26, 24, 19, 0) 30%, rgba(26, 24, 19, .85) 100%);
}
.plan-hero.is-memory::before { filter: sepia(.3) saturate(.9) contrast(1.05); }
.plan-hero > * { position: relative; z-index: 2; }
.plan-hero .icon-btn { background: rgba(255, 252, 246, .95); }
.plan-hero .crumb { color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
.hero-body { margin-top: auto; padding: 14px 18px 18px; }
.hero-body .chip { background: var(--lime); color: var(--ink); border-color: var(--ink); }
.hero-body h1 { font-size: 40px; font-weight: 800; margin: 10px 0 8px; text-shadow: 0 2px 16px rgba(0, 0, 0, .35); }
.meta { display: block; margin: 2px 0; font-size: 14px; font-weight: 600; text-decoration: none; opacity: .95; }
.hero-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; font-weight: 600; }
.hero-foot .av { border-color: var(--ink); }
.hero-foot .btn { margin-left: auto; }

.memory-strip { background: var(--sun); border-bottom: 2px solid var(--ink); padding: 14px 18px 16px; }
.memory-strip .hand { font: 700 34px/1 var(--f-hand); margin: 0 0 10px; transform: rotate(-1.5deg); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stats div { background: var(--card); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 6px; text-align: center; }
.stats b { display: block; font: 800 18px/1.1 var(--f-display); }
.stats small { font-size: 11px; color: var(--ink2); }

.tabs {
	position: sticky; top: 0; z-index: 10;
	display: flex; gap: 6px;
	overflow-x: auto;
	padding: 10px 14px;
	background: var(--paper);
	border-bottom: 2px solid var(--ink);
	scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--ink2); text-decoration: none; border: 2px solid transparent; }
.tab.on { background: var(--ink); color: var(--paper); }
.tab-body { padding: 18px 16px 30px; animation: rise .35s both; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q {
	display: block;
	padding: 14px;
	text-decoration: none;
	background: var(--card);
	border: 2px solid var(--ink);
	border-radius: 16px;
	box-shadow: 2px 2px 0 var(--ink);
}
.q small { display: block; font-size: 12px; color: var(--ink2); font-weight: 600; }
.q b { font: 800 19px/1.2 var(--f-display); }
.q.pos { background: #E4F7EC; }
.q.neg { background: #FDE6E2; }
.people { display: flex; flex-wrap: wrap; gap: 14px; }
.person { display: grid; justify-items: center; gap: 4px; width: 60px; text-align: center; }
.person small { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.strip img { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; border: 2px solid var(--ink); flex: none; }

/* Itinerario */
.it-day { margin: 0 0 22px; }
.sticker {
	display: inline-block;
	font: 800 15px/1 var(--f-body);
	text-transform: uppercase;
	letter-spacing: .05em;
	background: var(--lime);
	border: 2px solid var(--ink);
	padding: 7px 12px;
	border-radius: 8px;
	transform: rotate(-2deg);
	margin: 0 0 10px;
}
.it-item {
	display: grid;
	grid-template-columns: 58px 1fr;
	gap: 12px;
	width: 100%;
	text-align: left;
	background: none;
	border: 0;
	padding: 0 0 16px;
	position: relative;
	cursor: pointer;
}
.it-item::before { content: ""; position: absolute; left: 70px; top: 6px; bottom: 0; width: 2px; background: var(--ink); opacity: .2; }
.it-item::after { content: ""; position: absolute; left: 65px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--ink); }
.it-item time { font: 800 15px/1.4 var(--f-display); }
.it-item > div { padding-left: 22px; }
.it-item b { display: block; font-size: 16px; }
.it-item p { margin: 3px 0 0; font-size: 14px; color: var(--ink2); }

/* Listas */
.list-card { padding: 14px; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1.5px dashed rgba(26, 24, 19, .2); }
.li:last-child { border-bottom: 0; }
.check {
	width: 28px; height: 28px; flex: none;
	display: grid; place-items: center;
	border: 2px solid var(--ink);
	border-radius: 8px;
	background: var(--card);
	font-weight: 800;
	cursor: pointer;
}
.li.done .check { background: var(--lime); }
.li-title { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; font-weight: 600; }
.li-title small { display: block; font-weight: 400; color: var(--mute); font-size: 13px; }
.li.done .li-title { text-decoration: line-through; color: var(--mute); }
.who { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 12px; font-weight: 700; color: var(--ink2); border: 1.5px solid transparent; background: none; padding: 3px 8px 3px 3px; border-radius: 999px; cursor: pointer; }
.who.ghost { border: 1.5px dashed rgba(26, 24, 19, .35); padding: 5px 10px; color: var(--mute); }
.mine-card { background: var(--sun); font-size: 14px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px; }
.pick { display: grid; justify-items: center; gap: 5px; padding: 10px 4px; border: 2px solid transparent; border-radius: 16px; background: none; cursor: pointer; }
.pick small { font-size: 12px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.on { border-color: var(--ink); background: var(--lime); }
.quick-add { display: flex; gap: 8px; margin-top: 10px; }
.quick-add input { flex: 1; min-width: 0; }
.quick-add select { width: 36%; }

/* Gastos */
.money-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px; background: var(--ink); color: var(--paper); }
.money-hero small { display: block; font-size: 11px; opacity: .75; font-weight: 600; }
.money-hero strong { font: 800 19px/1.15 var(--f-display); }
.money-hero .pos strong { color: var(--lime); }
.money-hero .neg strong { color: #FF9A85; }
.settle, .exp, .bal-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1.5px dashed rgba(26, 24, 19, .2); }
.settle:last-of-type, .exp:last-child, .bal-row:last-child { border-bottom: 0; }
.settle .arrow { font-weight: 800; color: var(--accent); }
.settle .grow { font-size: 14px; }
.exp small { display: block; font-size: 12px; color: var(--mute); }
.bal-bar { width: 70px; height: 8px; border-radius: 4px; background: var(--paper2); overflow: hidden; }
.bal-bar i { display: block; height: 100%; }
.bal-bar .pos { background: var(--pos); }
.bal-bar .neg { background: var(--neg); }
.bal-row b { min-width: 74px; text-align: right; font-size: 14px; }

.split-list { border: 2px solid var(--ink); border-radius: var(--r-sm); background: var(--card); padding: 4px 12px; }
.split-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.split-row + .split-row { border-top: 1.5px dashed rgba(26, 24, 19, .2); }
.split-row .share-in { display: none; width: 96px; padding: 8px 10px; text-align: right; }
form.custom .split-row .share-in { display: block; }
form.custom .split-row input[type=checkbox] { display: none; }

/* Votaciones */
.poll h3 { font-size: 19px; }
.opt {
	position: relative;
	display: flex; align-items: center; gap: 8px;
	width: 100%;
	margin: 8px 0 0;
	padding: 12px 12px;
	border: 2px solid var(--ink);
	border-radius: 12px;
	background: var(--card);
	text-align: left;
	cursor: pointer;
	overflow: hidden;
	font-weight: 600;
}
.opt > * { position: relative; z-index: 1; }
.opt .fill { position: absolute; inset: 0 auto 0 0; z-index: 0; background: var(--lime); transition: width .45s cubic-bezier(.2, .9, .3, 1); }
.opt.mine { box-shadow: 2px 2px 0 var(--accent); border-color: var(--accent); }
.opt.win { background: var(--sun); }
.opt[disabled] { cursor: default; }
.opt b { font-size: 13px; }

/* Opciones con enlace (alojamientos, restaurantes…) */
.opt-wrap { display: flex; gap: 6px; align-items: stretch; }
.opt-wrap .opt { flex: 1; }
.opt-c { margin-top: 8px; flex: none; min-width: 46px; border: 2px solid var(--ink); border-radius: 12px; background: var(--card); font-size: 13px; font-weight: 700; cursor: pointer; }
.lopt { display: flex; gap: 12px; margin: 12px 0 0; padding: 10px; border: 2px solid var(--ink); border-radius: 16px; background: var(--card); }
.lopt.mine { border-color: var(--accent); box-shadow: 2px 2px 0 var(--accent); }
.lopt.win { background: #FFF4D6; }
.lopt-img { width: 96px; min-height: 96px; flex: none; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--paper2) center/cover no-repeat; font-size: 30px; cursor: pointer; }
.lopt-body { flex: 1; min-width: 0; }
.lopt-title { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; }
.lopt-title small { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.lopt-title b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.25; }
.lopt .opt { margin-top: 8px; padding: 8px 10px; }
.lopt-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; font-weight: 700; }
.lopt-foot a { text-decoration: none; }
.lp-img { display: block; margin: -4px 0 12px; aspect-ratio: 16/9; border: 2px solid var(--ink); border-radius: 16px; background: var(--paper2) center/cover no-repeat; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.quick-chips .chip { background: var(--card); color: var(--ink); cursor: pointer; font-size: 13px; padding: 7px 11px; }
.opt-row { display: grid; gap: 6px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1.5px dashed rgba(26, 24, 19, .2); }
.opt-row input[type=url] { font-size: 14px; padding: 9px 12px; }

/* Documentos */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; box-shadow: 2px 2px 0 var(--ink); }
.doc-prev { display: grid; place-items: center; align-content: center; gap: 4px; aspect-ratio: 4/3; background: var(--paper2) center/cover no-repeat; border-bottom: 2px solid var(--ink); text-decoration: none; }
.doc-ico { font-size: 38px; }
.doc-ext { font-size: 12px; letter-spacing: .08em; background: var(--ink); color: var(--paper); padding: 2px 8px; border-radius: 6px; }
.doc-meta { padding: 8px 10px 10px; }
.doc-title { display: block; width: 100%; border: 0; background: none; padding: 0; text-align: left; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.doc-meta small { font-size: 11px; color: var(--mute); }
.doc-del { position: absolute; top: 6px; right: 6px; background: var(--card); }

/* Fotos */
.photo-grid { columns: 3 110px; column-gap: 6px; }
.photo-grid button {
	position: relative;
	display: block;
	width: 100%;
	margin: 0 0 6px;
	padding: 0;
	border: 0;
	border-radius: 10px;
	overflow: hidden;
	background: var(--paper2);
	break-inside: avoid;
	cursor: zoom-in;
}
.photo-grid img { display: block; width: 100%; }
.ph-badge { position: absolute; left: 6px; bottom: 6px; background: rgba(26, 24, 19, .75); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 999px; }
.upload-progress { height: 6px; background: var(--paper2); border-radius: 3px; overflow: hidden; margin: 0 0 12px; border: 1.5px solid var(--ink); }
.upload-progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

.ph-view { position: relative; margin: -4px -18px 12px; background: #000; display: grid; place-items: center; min-height: 240px; }
.ph-view img { max-height: 64vh; width: auto; max-width: 100%; display: block; }
.ph-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .85); color: var(--ink); font-size: 24px; font-weight: 800; cursor: pointer; }
.ph-nav.prev { left: 10px; }
.ph-nav.next { right: 10px; }
.ph-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ph-meta small { display: block; opacity: .7; font-size: 12px; }
.reacts { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.react { border: 1.5px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); color: inherit; border-radius: 999px; padding: 7px 11px; cursor: pointer; font-size: 16px; }
.react.on { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.react b { font-size: 13px; }

/* Chat / comentarios */
.chat { display: grid; gap: 10px; margin-bottom: 14px; }
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg.mine { justify-content: flex-end; }
.bubble { max-width: 80%; background: var(--card); border: 2px solid var(--ink); border-radius: 16px 16px 16px 4px; padding: 8px 12px; }
.msg.mine .bubble { background: var(--lime); border-radius: 16px 16px 4px 16px; }
.bubble b { font-size: 12px; color: var(--accent); }
.bubble p { margin: 2px 0; }
.bubble small { font-size: 11px; color: var(--mute); }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; min-width: 0; }
.sheet-photo .bubble { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .25); color: var(--paper); }
.sheet-photo .msg.mine .bubble { background: var(--lime); color: var(--ink); }

/* ---------- Formularios ---------- */
.form { display: block; }
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 6px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
	width: 100%;
	font: 16px var(--f-body);
	padding: 12px 14px;
	border: 2px solid var(--ink);
	border-radius: var(--r-sm);
	background: var(--card);
	color: var(--ink);
	appearance: none;
	-webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 0 0 14px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }

.type-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tp input, .pp input, .swatch input, .emo input { position: absolute; opacity: 0; pointer-events: none; }
.tp span {
	display: grid; justify-items: center; gap: 2px;
	padding: 9px 4px;
	font-size: 22px;
	background: var(--card);
	border: 2px solid var(--ink);
	border-radius: 12px;
	cursor: pointer;
}
.tp small { font-size: 10.5px; font-weight: 700; }
.tp input:checked + span { background: var(--lime); box-shadow: 2px 2px 0 var(--ink); }
.people-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.pp { display: grid; justify-items: center; gap: 3px; width: 58px; cursor: pointer; }
.pp .av { opacity: .3; transition: opacity .15s, transform .15s; }
.pp input:checked + .av { opacity: 1; transform: scale(1.08); }
.pp small { font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emojis, .swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.emo span { display: grid; place-items: center; width: 44px; height: 44px; font-size: 22px; border: 2px solid var(--ink); border-radius: 12px; background: var(--card); cursor: pointer; }
.emo input:checked + span { background: var(--lime); box-shadow: 2px 2px 0 var(--ink); }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--ink); cursor: pointer; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }

/* ---------- Auth / unirse ---------- */
.auth { padding: calc(40px + var(--safe-t)) 18px 30px; }
.auth-brand { margin-bottom: 26px; }
.auth-brand .logo-mark { font-size: 58px; display: block; margin-bottom: 18px; }
.motto { display: grid; gap: 2px; margin: 0 0 16px; font: 800 30px/1.02 var(--f-display); text-transform: uppercase; letter-spacing: -.02em; }
.motto span:nth-child(1) { color: var(--ink); }
.motto span:nth-child(2) { color: var(--accent); padding-left: 1.2em; }
.motto span:nth-child(3) { color: transparent; -webkit-text-stroke: 1.5px var(--ink); padding-left: 2.4em; }
.lead { color: var(--ink2); font-size: 17px; margin: 0; max-width: 34ch; }
.auth-card .seg { margin-bottom: 18px; }
.invite-banner { background: var(--sun); display: flex; gap: 12px; align-items: center; }
.invite-banner .g-emoji { width: 48px; height: 48px; font-size: 24px; }
.join { text-align: center; padding: 30px 20px; }
.join .g-emoji { margin: 0 auto 16px; }
.join h1 { font-size: 34px; margin: 6px 0 10px; }
.join-wrap { padding: calc(60px + var(--safe-t)) 18px; }

/* ---------- Bottom sheet ---------- */
#cq-sheet { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#cq-sheet.open { pointer-events: auto; }
.sheet-bg { position: absolute; inset: 0; background: rgba(26, 24, 19, .55); opacity: 0; transition: opacity .25s; }
#cq-sheet.open .sheet-bg { opacity: 1; }
.sheet {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	max-width: 560px;
	margin: 0 auto;
	max-height: 92vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--paper);
	border: 2px solid var(--ink);
	border-bottom: 0;
	border-radius: 26px 26px 0 0;
	padding: 26px 18px calc(24px + var(--safe-b));
	transform: translateY(105%);
	transition: transform .32s cubic-bezier(.2, .9, .3, 1);
}
#cq-sheet.open .sheet { transform: none; }
.sheet::before { content: ""; position: absolute; top: 9px; left: 50%; width: 44px; height: 5px; border-radius: 3px; background: currentColor; opacity: .25; transform: translateX(-50%); }
.sheet-x { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid currentColor; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; z-index: 3; }
.sheet-title { font-size: 26px; margin: 4px 40px 18px 0; }
.sheet-photo { background: var(--ink); color: var(--paper); }
.sheet-photo .sheet-x { background: rgba(26, 24, 19, .6); color: #fff; }
.menu-list { display: grid; gap: 8px; }
.menu-list .btn { justify-content: flex-start; width: 100%; }
.linkbox { display: flex; gap: 8px; margin: 0 0 12px; }
.linkbox input { font-size: 13px !important; }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share-actions .btn:first-child { grid-column: 1 / -1; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }

/* AI */
.ai-card h3 { font-size: 19px; }
.ai-card p { font-size: 14px; margin: 10px 0; }
.ai-card details { margin: 0 0 10px; font-size: 14px; }
.ai-card summary { cursor: pointer; font-weight: 700; }
.mini-it { margin: 8px 0 0; padding-left: 18px; }
.mini-it li { margin: 3px 0; }
.ai-loading { text-align: center; padding: 40px 10px; }
.ai-loading p { font: 700 26px/1.1 var(--f-hand); }

/* ---------- Toast / loading ---------- */
#cq-toast {
	position: fixed;
	z-index: 80;
	left: 50%;
	bottom: calc(96px + var(--safe-b));
	transform: translate(-50%, 20px);
	opacity: 0;
	pointer-events: none;
	background: var(--ink);
	color: var(--paper);
	padding: 12px 18px;
	border-radius: 999px;
	font-weight: 700;
	font-size: 14px;
	max-width: calc(100vw - 32px);
	transition: .25s;
	box-shadow: 3px 3px 0 var(--accent);
}
#cq-toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { min-height: 60vh; display: flex; justify-content: center; align-items: center; gap: 8px; }
.loading span { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); animation: bounce .9s infinite ease-in-out; }
.loading span:nth-child(2) { animation-delay: .12s; background: var(--accent); }
.loading span:nth-child(3) { animation-delay: .24s; }

/* ---------- Animaciones ---------- */
.stagger > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6) { animation-delay: .25s; }
.stagger > *:nth-child(n+7) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
@keyframes pulse { 50% { transform: scale(.94); opacity: .6; } }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}
