/* MiPet360 — estilos. Base cálida (naranjo + verde), modo oscuro automático. */
:root {
  --accent: #e0703a;
  --accent-2: #2f8f6b;
  --bg: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f4ede3;
  --ink: #2a2118;
  --ink-2: #5e5245;
  --ink-3: #8f8273;
  --line: #eadfd0;
  --ok: #2f855a;
  --bad: #c53030;
  --warn: #b7791f;
  --radius: 18px;
  --shadow: 0 1px 2px rgb(42 33 24 / 6%), 0 8px 24px rgb(42 33 24 / 7%);
  --on-accent: #ffffff;
  --display: 'Fredoka', 'Inter', system-ui, sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-ink: color-mix(in srgb, var(--accent) 78%, #000);
  --green-soft: color-mix(in srgb, var(--accent-2) 14%, transparent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #161310; --surface: #201c17; --surface-2: #2b2620; --ink: #f6efe6; --ink-2: #c9bcad; --ink-3: #96897a; --line: #3a332b;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    --accent-ink: color-mix(in srgb, var(--accent) 72%, #fff);
    color-scheme: dark;
  }
}
/* Modo elegido a mano (estilo de la mascota o Cuenta → Apariencia). */
:root[data-theme='dark'] {
  --bg: #161310; --surface: #201c17; --surface-2: #2b2620; --ink: #f6efe6; --ink-2: #c9bcad; --ink-3: #96897a; --line: #3a332b;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  --accent-ink: color-mix(in srgb, var(--accent) 72%, #fff);
  color-scheme: dark;
}
/* Tipografía de títulos elegida para la mascota. */
:root[data-font='classic'] { --display: 'Fraunces', Georgia, serif; }
:root[data-font='elegant'] { --display: 'Cormorant Garamond', Georgia, serif; }
:root[data-font='elegant'] h1, :root[data-font='elegant'] h2 { font-style: italic; }
:root[data-font='modern'] { --display: 'Space Grotesk', 'Inter', sans-serif; }

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 7vw, 3.2rem); }
h2 { font-size: clamp(1.35rem, 4vw, 1.8rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: .875rem; }
.small { font-size: .875rem; }
.boot { display: grid; place-items: center; min-height: 100vh; font: 600 1.6rem var(--display); color: var(--ink-3); }
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wide { max-width: 1000px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Botones y formularios --- */
.btn { appearance: none; border: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 600 1rem var(--sans);
  transition: transform .08s, filter .15s, opacity .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-line { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-green { background: var(--accent-2); color: #fff; }
.btn-danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-red { background: var(--bad); color: #fff; }
.btn-whatsapp { background: #1fa855; color: #fff; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: .875rem; }
.btn-tiny { min-height: 30px; padding: 0 10px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-ghost-light { background: rgb(255 255 255 / 14%); color: #fff; }
.linkish { appearance: none; background: none; border: 0; color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; padding: 6px 2px; text-decoration: underline; text-underline-offset: 3px; }
label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 6px; color: var(--ink-2); }
input, select, textarea { width: 100%; font: 1rem var(--sans); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; min-height: 48px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; min-height: 88px; }
input[type='checkbox'] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); flex: none; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--ink); margin: 0; }
.field + .field { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid2 > .field + .field { margin-top: 0; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

/* --- Tarjetas --- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card-flat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin-bottom: 8px; }
.empty { text-align: center; padding: 32px 16px; color: var(--ink-3); }
.empty .big { font-size: 2.6rem; display: block; margin-bottom: 6px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.pill-red { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.pill-green { background: var(--green-soft); color: var(--accent-2); }
.pill-orange { background: var(--accent-soft); color: var(--accent-ink); }
.alert { border-radius: var(--radius); padding: 14px 16px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.alert-red { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.alert-green { background: var(--green-soft); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin: 22px 0 10px; }
.section-title h2, .section-title h3 { margin: 0; }

/* --- Barra superior y navegación inferior --- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 10px; min-height: 58px; }
.lang-btn { font-size: 1.15rem; line-height: 1; padding-inline: 8px; }
.sheet-back.lang-sheet { z-index: 260; }
.lang-float { position: absolute; top: 10px; right: 12px; z-index: 5; }
.brand { font: 600 1.25rem var(--display); color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.brand b { color: var(--accent); font-weight: 600; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
.bottomnav a { flex: 1; display: grid; justify-items: center; gap: 1px; text-decoration: none; color: var(--ink-3); font-size: .72rem; font-weight: 600; padding: 4px 0; border-radius: 12px; position: relative; }
.bottomnav a span { font-size: 1.35rem; line-height: 1.2; }
.bottomnav a[aria-current='page'] { color: var(--accent-ink); background: var(--accent-soft); }
.bottomnav .dot { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--bad); color: #fff; font-size: .65rem; display: grid; place-items: center; padding: 0 3px; }
.has-nav { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.page { padding-top: 18px; padding-bottom: 32px; }

/* --- Pestañas y chips --- */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 14px 0 16px; scrollbar-width: none; position: sticky; top: 58px; z-index: 15; background: var(--bg); }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; appearance: none; border: 0; background: none; padding: 12px 12px; font: 600 .92rem var(--sans); color: var(--ink-3); cursor: pointer; border-bottom: 2.5px solid transparent; }
.tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 7px 12px; font: 500 .85rem var(--sans); cursor: pointer; white-space: nowrap; flex: none; }
.chip[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* --- Avatares y fotos de mascota --- */
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; overflow: hidden; }
.av { --h: 25; background: linear-gradient(135deg, hsl(var(--h) 75% 62%), hsl(calc(var(--h) + 40) 70% 48%)); color: #fff; }
.av.has-photo { background: var(--surface-2); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.pet-pic { flex: none; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 1.8rem; background: var(--accent-soft); }
.pet-pic img { width: 100%; height: 100%; object-fit: cover; }
.pet-pic.big { width: 120px; height: 120px; font-size: 3.6rem; box-shadow: 0 0 0 4px var(--surface), var(--shadow); }
.pet-pic.xl { width: 180px; height: 180px; font-size: 5rem; box-shadow: 0 0 0 5px var(--surface), var(--shadow); }
.pet-card { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.pet-card .grow h3 { margin: 0; }
.pet-list { display: grid; gap: 12px; }
.pet-head { display: flex; gap: 16px; align-items: center; }
.pet-head h1 { margin: 0; font-size: clamp(1.8rem, 6vw, 2.4rem); }

/* --- Grilla de fotos --- */
.grid-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 0; padding: 0; cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .badge { position: absolute; top: 6px; right: 6px; background: rgb(0 0 0 / 55%); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .75rem; }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; background: linear-gradient(transparent, rgb(0 0 0 / 65%)); color: #fff; font-size: .75rem; font-weight: 600; text-align: left; }
.month-head { margin: 18px 0 8px; font: 600 1rem var(--display); color: var(--ink-2); }

/* --- Hoy: acciones rápidas, registro, remedios --- */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button { appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 16px; padding: 10px 4px; display: grid; justify-items: center; gap: 2px; font: 600 .78rem var(--sans); cursor: pointer; min-height: 72px; }
.quick button span { font-size: 1.6rem; line-height: 1.1; }
.quick button:active { transform: scale(.96); }
.quick button.done { border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); background: var(--green-soft); }
.logline { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.logline:last-child { border-bottom: 0; }
.logline .ico { font-size: 1.3rem; width: 30px; text-align: center; flex: none; }
.logline img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.dose { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dose:last-child { border-bottom: 0; }
.dose .time { font: 700 1rem var(--display); width: 54px; flex: none; }
.dose.late .time { color: var(--bad); }
.dose.given .time { color: var(--ok); }
.turn { display: flex; gap: 8px; align-items: center; }
.list-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .ico { font-size: 1.4rem; width: 32px; text-align: center; flex: none; }
.memory { display: flex; gap: 12px; align-items: center; }
.memory img { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; flex: none; }

/* --- Salud --- */
.chart { width: 100%; height: auto; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent-soft); }
.chart .dotp { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart text { fill: var(--ink-3); font: 11px var(--sans); }
.chart .grid { stroke: var(--line); stroke-width: 1; }

/* --- Logros --- */
.points-big { font: 600 3rem var(--display); color: var(--accent); line-height: 1; }
.challenge { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.challenge:last-child { border-bottom: 0; }
.challenge .ico { font-size: 1.6rem; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex: none; filter: grayscale(1); opacity: .6; }
.challenge.done .ico { filter: none; opacity: 1; background: var(--accent-soft); }
.countdown { display: flex; align-items: center; gap: 14px; }
.countdown .num { font: 600 2.4rem var(--display); color: var(--accent); line-height: 1; }

/* --- Mapa de avistamientos y recorridos --- */
.map-bg { fill: color-mix(in srgb, var(--accent-2) 8%, var(--surface)); stroke: var(--line); }
.map-path { fill: none; stroke: var(--accent); stroke-width: 5; stroke-dasharray: 8 6; stroke-linecap: round; }
.map-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.map-dot.last { fill: var(--bad); }
.chart .map-label { fill: var(--ink-2); font: 700 30px var(--sans); }
.chart .map-label.last { fill: var(--bad); }
.map-scale { stroke: var(--ink-3); stroke-width: 4; }
.chart.sightings-map text:not(.map-label) { font-size: 26px; }
.walk-route { fill: none; stroke: var(--accent-2); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.walk-big { font: 600 3.2rem var(--display); line-height: 1; }
.walk-panel { position: fixed; inset: 0; z-index: 210; background: var(--bg); display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.stars { color: #f5b301; letter-spacing: 1px; }
.star-pick button { font-size: 1.8rem; background: none; border: 0; cursor: pointer; padding: 2px; color: var(--line); }
.star-pick button.on { color: #f5b301; }
.memorial-head { background: linear-gradient(135deg, #e9e4f5, #f7efe6); border-radius: var(--radius); padding: 18px; text-align: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .memorial-head { background: linear-gradient(135deg, #2b2638, #2b2620); } }
.check-list label.check { padding: 6px 0; }

/* --- Página pública de la placa --- */
.tag-page { min-height: 100vh; }
.tag-hero { text-align: center; padding: 28px 16px 8px; display: grid; justify-items: center; gap: 10px; }
.tag-hero h1 { margin: 6px 0 0; }
.lost-banner { background: var(--bad); color: #fff; text-align: center; padding: 12px 16px; font: 700 1.15rem var(--display); letter-spacing: .02em; animation: pulse 1.6s infinite; }
.emergency { border-left: 4px solid var(--bad); }
.qr-box { background: #fff; padding: 12px; border-radius: 16px; width: 200px; margin: 0 auto; }
.qr-box svg { width: 100%; height: auto; display: block; }
.thread { display: grid; gap: 8px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); }
.msg.me { justify-self: end; background: var(--accent); color: var(--on-accent); }
.msg .faint { color: inherit; opacity: .75; font-size: .75rem; }
.msg a { color: inherit; font-weight: 600; }

/* --- Comunidad --- */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.pcard .pic { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; font-size: 3.4rem; overflow: hidden; }
.pcard .pic img { width: 100%; height: 100%; object-fit: cover; }
.pcard .body { padding: 12px 14px; display: grid; gap: 4px; }
.pcard .body h3 { margin: 0; }
.entry .vote { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.place { display: grid; gap: 4px; }

/* --- Avisos --- */
.notif { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.notif.unread { font-weight: 600; }
.notif .ico { font-size: 1.2rem; }

/* --- Capas (hojas, preguntas, visor) --- */
#toasts { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 220; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: rise .25s ease; transition: opacity .4s, transform .4s; }
.toast-error { background: var(--bad); color: #fff; }
.toast-ok { background: var(--ok); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
.sheet-back { position: fixed; inset: 0; z-index: 200; background: rgb(0 0 0 / 40%); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: rise .25s; max-height: 92vh; overflow: auto; }
@media (min-width: 640px) { .sheet-back { align-items: center; } .sheet { border-radius: 22px; } }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgb(0 0 0 / 92%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 12px; }
.lightbox img { max-height: calc(100vh - 140px); max-width: 100%; border-radius: 8px; }
.lightbox-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgb(255 255 255 / 14%); color: #fff; font-size: 1.2rem; cursor: pointer; z-index: 3; }
.lightbox-meta { display: flex; gap: 12px; align-items: center; color: #fff; flex-wrap: wrap; justify-content: center; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; max-width: 100%; touch-action: pan-y; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 45%); color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lb-nav.prev { left: 6px; }
.lb-nav.next { right: 6px; }
.lb-pos { position: absolute; top: 20px; left: 16px; color: #fff; font: 600 .85rem var(--sans); opacity: .85; z-index: 2; }
.lb-pos:empty { display: none; }
#app[aria-busy='true']::before { content: ''; position: fixed; top: 0; left: 0; z-index: 500; height: 3px; width: 40%; background: var(--accent); animation: loadbar 1s ease-in-out infinite; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* --- Portada --- */
.hero { padding: 36px 0 12px; text-align: center; }
.hero .paws { font-size: 3rem; }
.hero p { font-size: 1.1rem; }
.feature-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.feature .ico { font-size: 1.8rem; }
.feature h3 { margin: 6px 0 4px; }
.auth { min-height: 80vh; display: grid; place-items: center; padding: 28px 16px; }
.auth .card { width: 100%; max-width: 420px; }

/* --- Impresión (ficha del vet, placas) --- */
.print-area { display: none; }
@media print {
  body.printing > :not(.print-area) { display: none !important; }
  body.printing .print-area { display: block; color: #000; }
}
@media print {
  .no-print, .topbar, .bottomnav, #toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .card-flat { box-shadow: none; break-inside: avoid; }
  .has-nav { padding-bottom: 0; }
}
.sheet-print table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.sheet-print th, .sheet-print td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sheet-print th { color: var(--ink-3); font-weight: 600; font-size: .8rem; }

@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes loadbar { 0% { left: -40%; } 100% { left: 100%; } }
@keyframes pulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.15); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* --- Fondos decorativos: máscara SVG pintada con el color de la mascota --- */
[data-pattern='dots'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2736%27 height=%2736%27 viewBox=%270 0 36 36%27%3E%3Ccircle cx=%276%27 cy=%276%27 r=%273%27/%3E%3Ccircle cx=%2724%27 cy=%2724%27 r=%272%27/%3E%3C/svg%3E"); --pat-size: 36px 36px; }
[data-pattern='hearts'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2790%27 height=%2790%27 viewBox=%270 0 90 90%27%3E%3Cg transform=%27translate(8 6)%27%3E%3Cpath d=%27M12 21s-8-5.2-8-11a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 20 10c0 5.8-8 11-8 11z%27/%3E%3C/g%3E%3Cg transform=%27translate(56 52) scale(.7)%27%3E%3Cpath d=%27M12 21s-8-5.2-8-11a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 20 10c0 5.8-8 11-8 11z%27/%3E%3C/g%3E%3Ccircle cx=%2770%27 cy=%2718%27 r=%272%27/%3E%3Ccircle cx=%2722%27 cy=%2770%27 r=%272%27/%3E%3C/svg%3E"); --pat-size: 90px 90px; }
[data-pattern='stars'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27100%27 height=%27100%27 viewBox=%270 0 100 100%27%3E%3Cg transform=%27translate(10 8)%27%3E%3Cpath d=%27M12 1l2.2 8.8L23 12l-8.8 2.2L12 23l-2.2-8.8L1 12l8.8-2.2z%27/%3E%3C/g%3E%3Cg transform=%27translate(62 58) scale(.6)%27%3E%3Cpath d=%27M12 1l2.2 8.8L23 12l-8.8 2.2L12 23l-2.2-8.8L1 12l8.8-2.2z%27/%3E%3C/g%3E%3Ccircle cx=%2776%27 cy=%2720%27 r=%272%27/%3E%3Ccircle cx=%2728%27 cy=%2776%27 r=%271.6%27/%3E%3Ccircle cx=%2788%27 cy=%2788%27 r=%271.4%27/%3E%3C/svg%3E"); --pat-size: 100px 100px; }
[data-pattern='confetti'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27120%27 height=%27120%27 viewBox=%270 0 120 120%27%3E%3Crect x=%2710%27 y=%2714%27 width=%2712%27 height=%274%27 rx=%272%27 transform=%27rotate(30 16 16)%27/%3E%3Crect x=%2770%27 y=%2720%27 width=%2710%27 height=%274%27 rx=%272%27 transform=%27rotate(-40 75 22)%27/%3E%3Crect x=%2740%27 y=%2770%27 width=%2712%27 height=%274%27 rx=%272%27 transform=%27rotate(60 46 72)%27/%3E%3Crect x=%2792%27 y=%2786%27 width=%2710%27 height=%274%27 rx=%272%27 transform=%27rotate(15 97 88)%27/%3E%3Ccircle cx=%2748%27 cy=%2730%27 r=%273%27/%3E%3Ccircle cx=%27100%27 cy=%2754%27 r=%272.5%27/%3E%3Ccircle cx=%2718%27 cy=%2796%27 r=%273%27/%3E%3Ccircle cx=%2776%27 cy=%27108%27 r=%272%27/%3E%3C/svg%3E"); --pat-size: 120px 120px; }
[data-pattern='waves'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27120%27 height=%2736%27 viewBox=%270 0 120 36%27%3E%3Cpath d=%27M0 18 Q15 6 30 18 T60 18 T90 18 T120 18%27 fill=%27none%27 stroke=%27black%27 stroke-width=%272.5%27/%3E%3C/svg%3E"); --pat-size: 120px 36px; }
[data-pattern='paws'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27100%27 height=%27100%27 viewBox=%270 0 100 100%27%3E%3Cg transform=%27translate(10 12)%27%3E%3Cellipse cx=%2712%27 cy=%2717%27 rx=%277%27 ry=%276%27/%3E%3Ccircle cx=%273.5%27 cy=%279%27 r=%273%27/%3E%3Ccircle cx=%279%27 cy=%273.5%27 r=%273%27/%3E%3Ccircle cx=%2715%27 cy=%273.5%27 r=%273%27/%3E%3Ccircle cx=%2720.5%27 cy=%279%27 r=%273%27/%3E%3C/g%3E%3Cg transform=%27translate(62 58) rotate(22) scale(.75)%27%3E%3Cellipse cx=%2712%27 cy=%2717%27 rx=%277%27 ry=%276%27/%3E%3Ccircle cx=%273.5%27 cy=%279%27 r=%273%27/%3E%3Ccircle cx=%279%27 cy=%273.5%27 r=%273%27/%3E%3Ccircle cx=%2715%27 cy=%273.5%27 r=%273%27/%3E%3Ccircle cx=%2720.5%27 cy=%279%27 r=%273%27/%3E%3C/g%3E%3C/svg%3E"); --pat-size: 100px 100px; }
[data-pattern='bones'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27110%27 height=%27110%27 viewBox=%270 0 110 110%27%3E%3Cg transform=%27translate(14 26) rotate(-25)%27%3E%3Crect x=%276%27 y=%273%27 width=%2726%27 height=%277%27 rx=%273%27/%3E%3Ccircle cx=%276%27 cy=%273%27 r=%274%27/%3E%3Ccircle cx=%276%27 cy=%2710%27 r=%274%27/%3E%3Ccircle cx=%2732%27 cy=%273%27 r=%274%27/%3E%3Ccircle cx=%2732%27 cy=%2710%27 r=%274%27/%3E%3C/g%3E%3Cg transform=%27translate(60 70) rotate(18) scale(.8)%27%3E%3Crect x=%276%27 y=%273%27 width=%2726%27 height=%277%27 rx=%273%27/%3E%3Ccircle cx=%276%27 cy=%273%27 r=%274%27/%3E%3Ccircle cx=%276%27 cy=%2710%27 r=%274%27/%3E%3Ccircle cx=%2732%27 cy=%273%27 r=%274%27/%3E%3Ccircle cx=%2732%27 cy=%2710%27 r=%274%27/%3E%3C/g%3E%3C/svg%3E"); --pat-size: 110px 110px; }
[data-pattern='fish'] { --pat: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27110%27 height=%2790%27 viewBox=%270 0 110 90%27%3E%3Cg transform=%27translate(12 14)%27%3E%3Cellipse cx=%2714%27 cy=%278%27 rx=%2712%27 ry=%277%27/%3E%3Cpath d=%27M24 8 L34 0 L34 16 Z%27/%3E%3C/g%3E%3Cg transform=%27translate(64 56) scale(.7)%27%3E%3Cellipse cx=%2714%27 cy=%278%27 rx=%2712%27 ry=%277%27/%3E%3Cpath d=%27M24 8 L34 0 L34 16 Z%27/%3E%3C/g%3E%3C/svg%3E"); --pat-size: 110px 90px; }
[data-pattern] body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--accent); opacity: .10;
  -webkit-mask: var(--pat) 0 0 / var(--pat-size) repeat; mask: var(--pat) 0 0 / var(--pat-size) repeat;
}
:root[data-theme='dark'][data-pattern] body::before { opacity: .16; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light'])[data-pattern] body::before { opacity: .16; } }
.look-sample[data-pattern]::before { content: ''; position: absolute; inset: 0; background: var(--c); opacity: .2; -webkit-mask: var(--pat) 0 0 / var(--pat-size) repeat; mask: var(--pat) 0 0 / var(--pat-size) repeat; }

/* --- Editor de estilo --- */
.looks { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.look { border: 2px solid var(--line); border-radius: 16px; padding: 0; overflow: hidden; cursor: pointer; background: var(--surface); color: var(--ink); text-align: left; font: 600 .85rem var(--sans); }
.look[aria-pressed='true'] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.look-sample { position: relative; height: 64px; display: grid; place-items: center; background: var(--bg-s); overflow: hidden; }
.look-sample b { position: relative; color: var(--c); font-size: 1.6rem; }
.look > span { display: block; padding: 8px 10px; }
.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.choice { border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px; text-align: left; cursor: pointer; color: var(--ink); font: 500 .85rem var(--sans); }
.choice b { display: block; font-size: 1.4rem; line-height: 1.2; }
.choice small { color: var(--ink-3); }
.choice[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.choice[data-font='playful'] b, .look[data-font='playful'] b { font-family: 'Fredoka', sans-serif; }
.choice[data-font='classic'] b, .look[data-font='classic'] b { font-family: 'Fraunces', serif; }
.choice[data-font='elegant'] b, .look[data-font='elegant'] b { font-family: 'Cormorant Garamond', serif; font-style: italic; }
.choice[data-font='modern'] b, .look[data-font='modern'] b { font-family: 'Space Grotesk', sans-serif; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--ink); }
input[type='color'] { width: 44px; height: 40px; min-height: 0; padding: 2px; border-radius: 10px; cursor: pointer; }
/* Editor de portada */
.cover-editor { max-width: 720px; }
.cover-frame { position: relative; border-radius: 14px; overflow: hidden; background: #111; }
.cover-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; touch-action: none; cursor: grab; }
.cover-canvas:active { cursor: grabbing; }
.cover-hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); background: rgb(0 0 0 / 55%); color: #fff; font-size: .75rem; padding: 3px 10px; border-radius: 99px; pointer-events: none; white-space: nowrap; }
.cover-zoom { flex-wrap: nowrap; }
.cover-zoom input { flex: 1; min-width: 0; accent-color: var(--accent); }
.cover-tools { gap: 6px; }


/* --- Portada de la mascota (como EVENT360) --- */
.pet-cover { height: 150px; border-radius: var(--radius); background: var(--accent) center / cover; margin-bottom: -46px; box-shadow: var(--shadow); }
.pet-cover.empty { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); }
.with-cover .pet-head, .with-cover .tag-hero { position: relative; }
.with-cover .pet-head { padding-left: 12px; }
.tag-cover { height: 190px; border-radius: var(--radius); background: var(--accent) center / cover; margin-bottom: -80px; }
.greeting { font-size: 1.05rem; text-align: center; white-space: pre-line; }
.cover-edit { aspect-ratio: 16 / 9; border-radius: 14px; background: var(--surface-2) center / cover; display: grid; place-items: center; color: var(--ink-3); border: 1.5px dashed var(--line); }
.mini-phone { width: 100%; max-width: 270px; margin: 0 auto; border-radius: 32px; background: #111; padding: 10px; box-shadow: var(--shadow); }
.mini-phone .scr { border-radius: 24px; overflow: hidden; background: var(--bg); min-height: 380px; position: relative; z-index: 0; color: var(--ink); }
.mini-phone .scr[data-pattern]::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--accent); opacity: .12; -webkit-mask: var(--pat) 0 0 / var(--pat-size) repeat; mask: var(--pat) 0 0 / var(--pat-size) repeat; }
.mini-phone .pv-cover { height: 96px; background: var(--accent) center / cover; }
.mini-phone .pv-body { padding: 0 12px 14px; display: grid; gap: 8px; justify-items: center; text-align: center; }
.mini-phone .pv-body .pet-pic { width: 84px; height: 84px; font-size: 2.6rem; margin-top: -42px; box-shadow: 0 0 0 4px var(--bg); }
.mini-phone h1 { font-size: 1.3rem; margin: 0; }
.design-cols { display: grid; gap: 18px; }
@media (min-width: 760px) { .design-cols { grid-template-columns: 1fr 290px; align-items: start; } .design-cols .preview-col { position: sticky; top: 70px; } }
.sheet:has(.design-cols) { max-width: 920px; }

.mood-bars { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.mood-bars > div { flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; }
.streak { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, #f59e0b 18%, transparent); color: color-mix(in srgb, #f59e0b 70%, var(--ink)); }
.lost-overlay { position: fixed; inset: 0; z-index: 215; background: #c53030; color: #fff; display: grid; place-items: center; padding: 24px 18px; text-align: center; }
.lost-overlay .pet-pic { box-shadow: 0 0 0 5px rgb(255 255 255 / 70%); margin: 0 auto; }
.lost-overlay .btn { background: #fff; color: #c53030; min-height: 58px; font-size: 1.1rem; }
.lost-overlay .btn-ghost-light { background: rgb(255 255 255 / 16%); color: #fff; }
.offline-bar { position: sticky; top: 58px; z-index: 18; background: var(--ink); color: var(--bg); text-align: center; font-size: .85rem; padding: 6px; }
.code-input { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; text-align: center; }
