/* Tipografía: Nunito (textos) y Pixelify Sans (títulos, como el logo). Licencia OFL;
   van dentro del sitio para funcionar sin internet y sin abrir la política de seguridad. */
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url('fonts/nunito-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Nunito'; font-style: normal; font-display: swap; font-weight: 200 1000;
  src: url('fonts/nunito-latin-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Pixelify Sans'; font-style: normal; font-display: swap; font-weight: 400 700;
  src: url('fonts/pixelify-sans-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Pixelify Sans'; font-style: normal; font-display: swap; font-weight: 400 700;
  src: url('fonts/pixelify-sans-latin-ext-wght-normal.woff2') format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  --bg: #fbf6ef;
  --card: #ffffff;
  --ink: #3a2c25;
  --muted: #8a7466;
  --line: #eadfd2;
  --accent: #ffcf5a;
  --accent-ink: #3a2c25;
  --brand: #e0525c;
  --ok: #3f9c6b;
  --due: #e0525c;
  --memorial: #5a5285;
  --memorial-bg: #f1eff8;
  --radius: 14px;
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Pixelify Sans", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
}

body { display: flex; }

button, input, select, textarea { font: inherit; color: inherit; }

canvas { image-rendering: pixelated; }

/* ---------- Barra lateral ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px;
  background: #f4ebdf;
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 0 6px 12px;
}
#pet-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.pet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.pet-item:hover { background: rgba(255, 255, 255, 0.6); }
.pet-item.active { background: var(--card); box-shadow: 0 1px 0 var(--line); }
.pet-item .name { font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-item .meta { font-size: 12px; color: var(--muted); }
.badge {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--due);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}
.side-btn {
  margin-top: 6px;
  padding: 9px 12px;
  border: 1.5px dashed #d6c4b0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.side-btn:hover { background: rgba(255, 255, 255, 0.6); }
.side-btn.subtle { border: 0; color: var(--muted); }
.sidebar-foot { margin-top: auto; }

/* ---------- Principal ---------- */
main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 28px 36px 60px;
}
.page { max-width: 860px; margin: 0 auto; }

h1 { font-family: var(--font-display); font-weight: 600; font-size: 26px; margin: 0; letter-spacing: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* ---------- Encabezado de mascota ---------- */
.pet-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
}
.pet-header .stage {
  width: 200px;
  height: 120px;
  border-radius: var(--radius);
  background: linear-gradient(#fff 0 78%, #efe3d3 78%);
  border: 1px solid var(--line);
  display: grid;
  place-items: end center;
  overflow: hidden;
  flex-shrink: 0;
}
.pet-header.memorial .stage {
  position: relative;
  background:
    radial-gradient(26px 11px at 16% 24%, #fff 97%, transparent 100%),
    radial-gradient(17px 10px at 22% 19%, #fff 97%, transparent 100%),
    radial-gradient(14px 8px at 11% 27%, #fff 97%, transparent 100%),
    radial-gradient(32px 12px at 74% 16%, #fff 97%, transparent 100%),
    radial-gradient(19px 11px at 81% 11%, #fff 97%, transparent 100%),
    radial-gradient(20px 8px at 50% 38%, rgba(255, 255, 255, 0.8) 97%, transparent 100%),
    radial-gradient(circle at 50% 100%, #fff 0 15px, transparent 16px) bottom left / 32px 22px repeat-x,
    linear-gradient(#b9dcfa, #e4f0fd 65%, #f6f0ff);
  border-color: #cfe0f2;
}
.pet-header .title { flex: 1; min-width: 0; }
.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: #e9f5ee;
  color: var(--ok);
  margin-top: 6px;
}
.chip.due { background: #fde9eb; color: var(--due); }
.chip.memorial { background: var(--memorial-bg); color: var(--memorial); }
.photo-thumb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  padding: 9px 14px;
  border: 0;
  background: transparent;
  border-bottom: 2.5px solid transparent;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tab.active { color: var(--ink); border-bottom-color: var(--brand); }

/* ---------- Formularios ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 12.5px; font-weight: 650; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=search], input[type=date], input[type=datetime-local], input[type=time], input[type=number], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 70px; }
input[type=color] {
  width: 38px;
  height: 32px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--line);
  cursor: pointer;
}
.swatch.selected { box-shadow: 0 0 0 2.5px var(--ink); }

.look-layout { display: grid; grid-template-columns: 1fr 230px; gap: 22px; align-items: start; }
.preview-box { position: sticky; top: 0; text-align: center; }
.preview-box .stage {
  height: 170px;
  border-radius: var(--radius);
  background: linear-gradient(#fff 0 80%, #efe3d3 80%);
  border: 1px solid var(--line);
  display: grid;
  place-items: end center;
  overflow: hidden;
}
.seg { display: inline-flex; margin-top: 8px; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 10px; cursor: pointer; font-size: 12.5px; }
.seg button.on { background: var(--accent); font-weight: 650; }

.photo-pick {
  display: flex;
  align-items: center;
  gap: 14px;
}
.photo-pick .ph {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: #f4ebdf;
  border: 2px dashed #d6c4b0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  font-size: 26px;
}
.photo-pick .ph img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
}
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }
.btn.secondary { background: #fff; }
.btn.small { padding: 5px 10px; font-size: 12.5px; box-shadow: 0 1.5px 0 var(--ink); }
.btn.danger { background: #fff; color: var(--due); border-color: var(--due); box-shadow: 0 2px 0 var(--due); }
.btn.memorial { background: var(--memorial); color: #fff; border-color: #3d3763; box-shadow: 0 2px 0 #3d3763; }
.link { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 0; }
.actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.actions .spacer { flex: 1; }

/* ---------- Bienvenida ---------- */
.welcome { text-align: center; padding-top: 30px; }
.welcome .stage { height: 150px; display: grid; place-items: end center; }
.welcome .stage.pair { display: flex; justify-content: center; align-items: flex-end; gap: 0; }
.field > .seg { margin-top: 0; align-self: flex-start; }
.field > .seg button { padding: 8px 14px; font-size: 14px; }
.welcome h1 { font-size: 30px; margin: 14px 0 6px; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; text-align: left; }
.choice {
  padding: 22px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--card);
  cursor: pointer;
  text-align: left;
}
.choice:hover { border-color: var(--ink); }
.choice .emoji { font-size: 28px; }
.choice strong { display: block; font-size: 17px; margin: 8px 0 4px; }
.choice.memorial:hover { border-color: var(--memorial); }

/* ---------- Cuidados ---------- */
.note {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #fff7e3;
  border: 1px solid #f3e2b5;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 16px;
}
.care-list { display: flex; flex-direction: column; gap: 8px; }
.care {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.care.due { border-color: #f1b7bd; background: #fff8f8; }
.care.off { opacity: 0.6; }
.care .icon { font-size: 22px; width: 32px; text-align: center; }
.care .info { flex: 1; min-width: 0; }
.care .label { font-weight: 650; }
.care .when { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.care.due .when { color: var(--due); font-weight: 650; }
.care .when.nodate { color: #b07a12; }
.care-editor { border: 2px solid var(--ink); }
.times { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.times .t { display: flex; align-items: center; gap: 2px; }
.times input { width: 110px; }
.x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; padding: 2px 4px; }
.pick-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.pick input { width: 17px; height: 17px; accent-color: var(--brand); }
.pick .icon { font-size: 20px; }
.pick small { display: block; color: var(--muted); font-size: 12px; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log li:last-child { border-bottom: 0; }
.log .ago { margin-left: auto; color: var(--muted); }

/* ---------- Recuerdo ---------- */
.memorial-card {
  background: linear-gradient(180deg, #b9dcfa, #e4f0fd 55%, #f6f0ff);
  color: #3b3560;
  border: 1px solid #cfe0f2;
  border-radius: 18px;
  padding: 30px;
  text-align: center;
  margin-bottom: 16px;
}
.memorial-card .stage {
  height: 150px;
  display: grid;
  place-items: end center;
  position: relative;
  background:
    radial-gradient(26px 11px at 16% 24%, #fff 97%, transparent 100%),
    radial-gradient(17px 10px at 22% 19%, #fff 97%, transparent 100%),
    radial-gradient(14px 8px at 11% 27%, #fff 97%, transparent 100%),
    radial-gradient(32px 12px at 74% 16%, #fff 97%, transparent 100%),
    radial-gradient(19px 11px at 81% 11%, #fff 97%, transparent 100%),
    radial-gradient(20px 8px at 50% 38%, rgba(255, 255, 255, 0.8) 97%, transparent 100%),
    radial-gradient(circle at 50% 100%, #fff 0 19px, transparent 20px) bottom left / 40px 28px repeat-x,
    radial-gradient(ellipse 160px 90px at 50% 88%, rgba(255, 246, 214, 0.8), transparent 70%);
}
.memorial-card h2 { font-size: 28px; margin: 14px 0 4px; }
.memorial-card .dates { opacity: 0.85; }
.memorial-card blockquote {
  margin: 18px auto 0;
  max-width: 520px;
  font-size: 16px;
  font-style: italic;
  line-height: 1.55;
}
.memorial-card .photo-thumb { width: 110px; height: 110px; margin-top: 16px; border-color: #fff; box-shadow: 0 2px 10px rgba(80, 110, 160, 0.18); }
.memorial-card .stats { margin-top: 16px; font-size: 13px; opacity: 0.8; }

/* ---------- Modal y aviso ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 25, 0.4);
  display: grid;
  place-items: center;
  z-index: 10;
}
.modal {
  width: min(440px, 92vw);
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal h2 { margin-bottom: 8px; }
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  z-index: 20;
}

@media (max-width: 980px) {
  .look-layout { grid-template-columns: 1fr; }
  .preview-box { position: static; }
}

/* ---------- Celular / pantallas angostas ---------- */
@media (max-width: 720px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .brand { padding: 0 4px 0 0; font-size: 17px; flex-shrink: 0; }
  .brand span { display: none; }
  #pet-list { flex-direction: row; overflow: visible; gap: 4px; }
  .pet-item { width: auto; flex-shrink: 0; padding: 6px 10px; }
  .side-btn { margin-top: 0; flex-shrink: 0; padding: 7px 10px; white-space: nowrap; }
  .sidebar-foot { margin-top: 0; margin-left: auto; flex-shrink: 0; }
  main { padding: 16px 14px calc(40px + env(safe-area-inset-bottom)); overflow: visible; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .grid, .grid.three, .pick-list, .choices { grid-template-columns: 1fr; }
  .pet-header { gap: 12px; flex-wrap: wrap; }
  .pet-header .stage { width: 150px; height: 100px; }
  .photo-thumb { width: 56px; height: 56px; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
  .care { flex-wrap: wrap; gap: 10px; }
  .care .info { flex-basis: calc(100% - 50px); }
  .care .btn { flex: 1; justify-content: center; }
  .actions { justify-content: stretch; }
  .actions .btn { flex: 1; justify-content: center; }
  .welcome { padding-top: 10px; }
  .welcome h1 { font-size: 24px; }
  .memorial-card { padding: 22px 16px; }
  input, select, textarea { font-size: 16px; } /* evita el zoom automático de iPhone */
}
