@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage-grotesque-latin-standard-normal.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --ink: #2A1A4A;
  --yolk: #FFC928;
  --white: #FFFFFF;
  --muted: #5E5470;
  --line: #F1ECF7;
  --field: #F5F1FA;
  --chip-line: #E4DEEC;
  --pink: #FF5FA2;
  --pink-soft: #FFE0EE;
  --pink-ink: #A3124F;
  --pink-deep: #D6246E;
  --green: #2DBE6C;
  --green-ink: #11683A;
  --done-text: #8A8199;
  --red: #B3261E;
  --red-soft: #FDE8E7;
  --tip: #FFF4C2;
  --scrim: rgba(42, 26, 74, 0.42);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--white);
  color: var(--ink);
  font-family: 'Bricolage', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
input::placeholder { color: #7A7090; }

#app { max-width: 560px; margin: 0 auto; height: 100%; position: relative; }

/* ---------- Pantalla principal ---------- */
.main-screen { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

.hdr {
  flex-shrink: 0;
  background: var(--yolk);
  border-radius: 0 0 40px 40px;
  padding: calc(var(--safe-top) + 34px) 24px 24px;
  display: flex; flex-direction: column; gap: 14px;
  transition: padding 0.2s ease, border-radius 0.2s ease;
}
.hdr-full { display: flex; flex-direction: column; gap: 14px; }
.hdr-compact { display: none; justify-content: space-between; align-items: center; gap: 12px; }
.hdr.is-compact { padding: calc(var(--safe-top) + 12px) 24px 12px; border-radius: 0 0 24px 24px; }
.hdr.is-compact .hdr-full { display: none; }
.hdr.is-compact .hdr-compact { display: flex; }
.hdr-top { display: flex; justify-content: space-between; align-items: flex-start; }
.hdr-title { margin: 0; font-size: 46px; line-height: 0.9; font-weight: 800; font-stretch: 78%; letter-spacing: -0.02em; }
.hdr-chick { width: 86px; height: 86px; margin: -6px -4px 0 0; }
.hdr-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hdr-count { margin: 0; font-size: 18px; font-weight: 600; }
.hdr-mini { margin: 0; font-size: 24px; line-height: 1; font-weight: 800; font-stretch: 78%; }
.hdr-mini-count { margin: 0; font-size: 15px; font-weight: 700; }
.me-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px;
  border: 0; background: none; font-size: 14px; font-weight: 600;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--ink); background: var(--c, #ccc);
}
.offline {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px;
  background: var(--ink); color: var(--white); font-size: 14px; font-weight: 600; line-height: 1.3;
}
.offline svg { flex-shrink: 0; }

.list { flex: 1 1 auto; overflow-y: auto; padding: 10px 20px 20px; -webkit-overflow-scrolling: touch; outline: none; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1.5px solid var(--line); }
.check {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; padding: 0;
  border: 2.5px solid var(--ink); background: var(--white);
}
.check:active { background: var(--yolk); }
.row-main {
  flex: 1 1 auto; min-width: 0; min-height: 44px; border: 0; background: none; padding: 0;
  text-align: left; display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.row-name { font-size: 19px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.row-detail { font-size: 14px; color: var(--muted); line-height: 1.3; }
.who {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; background: var(--bg); color: var(--fg);
}

.done { margin-top: 26px; }
.done-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 4px; }
.done-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--muted); }
.link-btn { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--pink-ink); font-size: 15px; font-weight: 700; }
.row-done { border-bottom: 0; padding: 8px 0; }
.check-on { border: 0; background: var(--green); display: inline-flex; align-items: center; justify-content: center; }
.done-name { flex: 1; font-size: 17px; color: var(--done-text); text-decoration: line-through; text-decoration-thickness: 2px; overflow-wrap: anywhere; }

.tip { margin: 6px 0 10px; padding: 16px; border-radius: 20px; background: var(--tip); display: flex; flex-direction: column; gap: 10px; }
.tip h2 { margin: 0; font-size: 17px; font-weight: 800; }
.tip ul { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.35; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 28px 24px; text-align: center; }
.empty h2 { margin: 0; font-size: 28px; line-height: 1.05; font-weight: 800; font-stretch: 82%; }
.empty p { margin: 0; font-size: 17px; line-height: 1.4; color: var(--muted); }

/* ---------- Barra inferior ---------- */
.dock {
  flex-shrink: 0; background: var(--white); border-top: 1.5px solid var(--line);
  padding: 12px 16px calc(var(--safe-bottom) + 14px);
  display: flex; flex-direction: column; gap: 10px;
}
.dock-top:empty { display: none; }
.dock-top { display: flex; flex-direction: column; gap: 10px; }
.add-form { display: flex; gap: 10px; align-items: center; margin: 0; }
#add-input {
  flex: 1 1 auto; min-width: 0; height: 54px; border: 0; border-radius: 999px;
  background: var(--field); padding: 0 22px; font-size: 18px;
}
.add-btn {
  width: 54px; height: 54px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.pill {
  align-self: flex-start; min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px;
  background: var(--pink-soft); color: var(--pink-ink); font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px;
}
.sugg-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.sugg { display: flex; flex-wrap: wrap; gap: 8px; }
.sugg-btn {
  min-height: 40px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--pink);
  background: var(--pink-soft); font-size: 15px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
}

.toast {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 10px 16px; border-radius: 20px;
  background: var(--ink); color: var(--white);
}
.toast-row { display: flex; align-items: center; gap: 10px; }
.toast-text { flex: 1; font-size: 15px; font-weight: 600; line-height: 1.25; }
.toast-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toast-btn { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; font-size: 14px; font-weight: 800; white-space: nowrap; }
.toast-undo { background: var(--yolk); color: var(--ink); }
.toast-save { background: var(--pink); color: var(--ink); }
.toast-soft { background: rgba(255, 255, 255, 0.14); color: var(--white); font-weight: 700; }
.toast-x { width: 40px; height: 40px; flex-shrink: 0; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, 0.12); border-radius: 999px; padding: 2px; }
.stepper button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--white); font-size: 22px; font-weight: 700; }
.stepper span { min-width: 54px; text-align: center; font-size: 16px; font-weight: 800; color: var(--yolk); }

/* ---------- Fulls (sheets) ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-scrim { position: absolute; inset: 0; border: 0; background: var(--scrim); padding: 0; }
.sheet-panel {
  position: relative; width: 100%; max-width: 560px; margin: 0 auto; max-height: 92dvh;
  background: var(--white); border-radius: 32px 32px 0 0;
  padding: 14px 20px calc(var(--safe-bottom) + 24px);
  display: flex; flex-direction: column; gap: 16px;
  animation: up 0.22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet-panel { animation: none; } .hdr { transition: none; } }
.grabber { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--chip-line); flex-shrink: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-title { margin: 0; font-size: 26px; line-height: 1.05; font-weight: 800; font-stretch: 82%; }
.ghost-btn { min-height: 44px; padding: 0 8px; border: 0; background: none; font-size: 16px; font-weight: 700; color: var(--muted); }
.ghost-btn.pink { color: var(--pink-ink); }
.dark-btn { min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--ink); color: var(--yolk); font-size: 15px; font-weight: 800; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 15px; font-weight: 700; }
.field input {
  height: 54px; border: 0; border-radius: 16px; background: var(--field); padding: 0 16px; font-size: 17px;
}
.field input.strong { border: 2.5px solid var(--ink); background: var(--white); font-size: 18px; font-weight: 600; }
.field .hint { font-weight: 500; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--field); font-size: 24px; font-weight: 700; }
.qty span { min-width: 40px; text-align: center; font-size: 24px; font-weight: 800; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px;
  border-radius: 16px; border: 0; background: var(--pink-soft); text-align: left; width: 100%;
}
.switch-row strong { display: block; font-size: 16px; color: var(--pink-ink); }
.switch-row small { display: block; font-size: 14px; color: #6E1A40; }
.switch { width: 52px; height: 32px; flex-shrink: 0; border-radius: 999px; position: relative; background: #C9C1D6; transition: background 0.15s; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--white); transition: left 0.15s; }
.switch-row[aria-pressed="true"] .switch { background: var(--pink-deep); }
.switch-row[aria-pressed="true"] .switch::after { left: 24px; }
.info-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: var(--field); font-size: 15px; font-weight: 600; }
.btn-primary { height: 58px; border: 0; border-radius: 999px; background: var(--ink); color: var(--yolk); font-size: 19px; font-weight: 800; width: 100%; }
.btn-primary:disabled { opacity: 0.6; }
.danger-link { min-height: 48px; border: 0; background: none; font-size: 16px; font-weight: 700; color: var(--red); }
.stack-4 { display: flex; flex-direction: column; gap: 4px; }

/* Lo de sempre */
.hab-panel { padding-left: 0; padding-right: 0; gap: 14px; height: 88dvh; }
.hab-panel > .pad { padding: 0 20px; }
.hab-title-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { min-height: 28px; padding: 0 12px; border-radius: 999px; background: var(--green); color: #0B3D22; display: inline-flex; align-items: center; font-size: 14px; font-weight: 800; }
.search { position: relative; }
.search svg { position: absolute; left: 18px; top: 16px; }
.search input { width: 100%; height: 50px; border: 0; border-radius: 999px; background: var(--field); padding: 0 18px 0 46px; font-size: 17px; }
.hab-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.hab-body h3 { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--chip-line);
  background: var(--white); font-size: 16px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--yolk); border-color: var(--ink); }
.letter-group { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.letter { width: 22px; flex-shrink: 0; padding-top: 10px; font-size: 18px; font-weight: 800; color: var(--pink-ink); }
.letter-group .chips { gap: 8px; flex: 1; }
.muted { margin: 0; font-size: 15px; color: var(--muted); }
.edit-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1.5px solid var(--line); }
.edit-row input { flex: 1; min-width: 0; height: 48px; border: 0; background: none; padding: 0 4px; font-size: 17px; font-weight: 600; }
.trash { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--red-soft); display: inline-flex; align-items: center; justify-content: center; }
.inline-undo { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 16px; background: var(--ink); color: var(--white); font-size: 15px; font-weight: 600; }
.inline-undo span { flex: 1; }

/* ---------- Entrar ---------- */
.login {
  min-height: 100dvh; background: var(--yolk);
  padding: calc(var(--safe-top) + 56px) 24px calc(var(--safe-bottom) + 28px);
  display: flex; flex-direction: column; gap: 28px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.login-chick { width: 132px; height: 132px; }
.login-title { margin: 18px 0 0; font-size: 56px; line-height: 0.88; font-weight: 800; font-stretch: 76%; letter-spacing: -0.025em; }
.login-sub { margin: 10px 0 0; font-size: 18px; font-weight: 600; }
.login-card { margin-top: auto; background: var(--white); border-radius: 32px; padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.login-who { border: 0; margin: 0; padding: 0; }
.login-who legend { padding: 0; margin-bottom: 10px; font-size: 20px; font-weight: 800; }
.login-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.person {
  min-height: 64px; border-radius: 20px; border: 2.5px solid var(--chip-line); background: var(--white);
  display: flex; align-items: center; gap: 10px; padding: 0 12px; font-size: 18px; font-weight: 700;
}
.person[aria-pressed="true"] { border-color: var(--ink); background: var(--soft, #FFF4C2); }
.person .avatar { width: 36px; height: 36px; font-size: 14px; }
.login-error { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 15px; font-weight: 600; }
.login-note { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
