/* Tampinha app. Warm paper around one strong thing: the board's own black screen with its pixel face.
   Tokens on :root; dark mode follows the device. Mobile first, one column, max 720 px. */

:root {
  --coral: #ff7a59;
  --coral-deep: #e8613f;
  --coral-soft: #ffe1d4;
  --cream: #fff6ec;
  --paper: #fffdf9;
  --ink: #2b2118;
  --muted: #74604f;
  --line: #f0dccb;
  --line-strong: #e2c6ae;
  --mint: #1f8a5f;
  --honey: #f2b33d;
  --honey-soft: #fff0cc;
  --berry: #b52f52;
  --berry-soft: #fde3ea;
  --bezel: #2b2118;
  --screen: #000000;
  --focus: #2b2118;
  --shadow: 0 1px 0 rgba(43, 33, 24, 0.06), 0 8px 24px -16px rgba(120, 60, 20, 0.35);
  --radius: 16px;
  --radius-sm: 12px;
  --tab-h: 64px;
  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Varela Round", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-diary: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --coral: #ff8a6b;
    --coral-deep: #ff9a7f;
    --coral-soft: #4a2a1f;
    --cream: #1d1712;
    --paper: #271f19;
    --ink: #f4e7da;
    --muted: #bba795;
    --line: #3a2e25;
    --line-strong: #4d3d31;
    --mint: #4cc68f;
    --honey: #f5c25b;
    --honey-soft: #43361a;
    --berry: #ff8fab;
    --berry-soft: #45222c;
    --bezel: #4a3b2f;
    --focus: #ffd0bf;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.25), 0 10px 26px -18px rgba(0, 0, 0, 0.8);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabs { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px); }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
h1[tabindex="-1"]:focus, .view:focus { outline: none; }  /* focus moved there for screen readers, not a control */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--cream); padding: 10px 14px;
        border-radius: 10px; z-index: 50; text-decoration: none; }
.skip:focus { top: 12px; }

/* --- layout ----------------------------------------------------------------------------------------------------- */
.view {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  outline: none;
}
.booting { text-align: center; color: var(--muted); padding: 40vh 16px 0; font-family: var(--font-display); }

.page-head { display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 0; }
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
.page-sub { color: var(--muted); font-size: 16px; max-width: 34em; }
.lead { color: var(--muted); }
.muted { color: var(--muted); font-size: 15px; }
.empty { color: var(--muted); font-size: 15px; padding: 4px 0; }
.note { background: var(--honey-soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px; }
.warn { color: var(--berry); }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* --- the screen: the board's black AMOLED, with the pixel face on it ------------------------------------------- */
.screen {
  display: block;
  background: var(--screen);
  border-radius: 24%;
  box-shadow: 0 0 0 3px var(--bezel), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  flex: none;
}
.face-svg { display: block; width: 100%; height: 100%; }
.pet-off .screen, .scene .screen.is-off { box-shadow: 0 0 0 3px var(--line-strong); }

/* --- pet cards (Início) ---------------------------------------------------------------------------------------- */
.pets { display: flex; flex-direction: column; gap: 14px; }
.pet {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  grid-template-columns: 112px 1fr;
  grid-template-areas: "face info" "actions actions";
  column-gap: 16px;
  row-gap: 16px;
  align-items: center;
}
.pet-screen { grid-area: face; width: 112px; height: 112px; text-decoration: none; }
.pets-new .pet-on .pet-screen { animation: power-on 700ms cubic-bezier(.2, .8, .2, 1) both; }
.pet-info { grid-area: info; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pet-name { font-size: 26px; font-weight: 800; overflow-wrap: anywhere; }
.pet-status { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.pet-mood { color: var(--muted); font-size: 15px; }
.pet-hungry {
  align-self: flex-start; margin-top: 4px; background: var(--honey-soft); color: var(--ink); font-weight: 700;
  font-size: 14px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--honey);
}
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }  /* square: a pixel */
.dot-on { background: var(--mint); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 25%, transparent); }
.dot-off { background: var(--line-strong); }
.pet-actions { grid-area: actions; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pet-actions .btn-feed { grid-column: 1 / -1; }

/* One Tampinha (the usual case): her face is the page. */
.pets-one .pet { grid-template-columns: 1fr; grid-template-areas: "face" "info" "actions"; justify-items: center;
                 text-align: center; padding-top: 22px; }
.pets-one .pet-screen { width: min(62vw, 248px); height: min(62vw, 248px); }
.pets-one .pet-info { align-items: center; }
.pets-one .pet-name { font-size: 34px; }
.pets-one .pet-actions { width: 100%; }
.pets-one .pet-hungry { align-self: center; }

@keyframes power-on {
  0% { transform: scaleY(0.04) scaleX(0.7); filter: brightness(3); }
  45% { transform: scaleY(0.04) scaleX(1); filter: brightness(2); }
  100% { transform: none; filter: none; }
}

/* --- panels (lists on Início, sections on Eu) ------------------------------------------------------------------ */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; }
.panel-title { font-size: 19px; font-weight: 800; }
.panel-body { padding: 4px 16px 16px; }
.link { color: var(--coral-deep); font-weight: 700; text-decoration: none; padding: 10px 0; min-height: 44px;
        display: inline-flex; align-items: center; }
.link:hover { text-decoration: underline; }
@media (prefers-color-scheme: light) { .link { color: #b8452a; } }

.rows { list-style: none; margin: 0 -16px; padding: 0; }
.row + .row { border-top: 1px dashed var(--line); }
.row-link { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; text-decoration: none; min-height: 44px; }
.row-link:hover { background: color-mix(in srgb, var(--coral) 7%, transparent); }
.row-when { font-size: 14px; color: var(--muted); }
.row-when strong { color: var(--ink); }
.row-text { font-size: 16px; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; color: var(--muted); }

/* --- buttons ----------------------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 999px; border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 800; font-size: 16px; line-height: 1.1;
  text-decoration: none; cursor: pointer; text-align: center;
  transition: transform 80ms ease, background-color 120ms ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn .pix { width: 18px; height: 18px; }
.btn-primary { background: var(--coral); color: #2b2118; border-color: var(--coral); }
.btn-primary:hover { background: var(--coral-deep); border-color: var(--coral-deep); }
.btn-soft { background: var(--coral-soft); color: var(--ink); border-color: var(--coral-soft); }
.btn-soft:hover { border-color: var(--coral); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-danger { background: var(--berry); color: #fff; border-color: var(--berry); }
@media (prefers-color-scheme: dark) { .btn-danger { color: #2b0d16; } }
.btn-danger-quiet { background: transparent; color: var(--berry); border-color: var(--berry-soft); }
.btn-block { width: 100%; }
.btn-text {
  background: none; border: 0; padding: 10px 6px; min-height: 44px; min-width: 44px; cursor: pointer;
  font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.btn-text.danger { color: var(--berry); text-decoration-color: currentColor; }
.btn-icon {
  width: 48px; height: 48px; flex: none; border-radius: 14px; border: 2px solid var(--coral);
  background: var(--coral); color: #2b2118; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.btn-icon .pix { width: 18px; height: 18px; }
.btn-icon[disabled] { opacity: 0.45; cursor: default; }
.actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* --- forms ------------------------------------------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-weight: 700; font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; }
.input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 2px solid var(--line-strong); background: var(--paper); font-size: 16px;
}
textarea.input { resize: vertical; min-height: 72px; line-height: 1.4; }
select.input { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
  linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
  background-size: 6px 6px; background-repeat: no-repeat; }
.input:focus { border-color: var(--coral); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--coral) 30%, transparent); }
.input[readonly] { background: transparent; color: var(--muted); }
.form-error { color: var(--berry); font-weight: 700; background: var(--berry-soft); padding: 10px 12px; border-radius: var(--radius-sm); }
.counter { align-self: flex-end; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hours { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hours .label { font-weight: 600; color: var(--muted); }

.group { border: 0; margin: 0; padding: 16px; background: var(--paper); border: 1px solid var(--line);
         border-radius: var(--radius); display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.group-title { font-family: var(--font-display); font-weight: 800; font-size: 19px; padding: 0; float: left; width: 100%; }
.group-title + * { clear: both; }

/* segmented choices: radios underneath, so keyboard and screen readers get a plain radio group */
.seg { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.seg > .label { padding: 0; margin-bottom: 2px; float: left; width: 100%; }
.seg-row { clear: both; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
           background: var(--cream); border: 2px solid var(--line-strong); border-radius: 999px; }
.seg-opt { position: relative; display: flex; }
.seg-input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 4px 6px;
                border-radius: 999px; font-weight: 700; font-size: 15px; text-align: center; pointer-events: none; }
.seg-input:checked + span { background: var(--ink); color: var(--cream); }
.seg-input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 1px; }

/* chips */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 14px; border-radius: 999px;
        background: var(--coral-soft); font-weight: 600; font-size: 15px; max-width: 100%; }
.chip span { overflow-wrap: anywhere; }
/* 44x44 to touch, drawn as a small round mark: the negative margins keep the chip slim, and its edges reach into the
   8 px gap between chip rows without meeting the next row's targets */
.chip-x { position: relative; width: 44px; height: 44px; margin: -8px -4px -8px -6px; border: 0; background: none;
          border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
          color: var(--ink); flex: none; }
.chip-x::before { content: ""; position: absolute; width: 30px; height: 30px; border-radius: 999px; }
.chip-x .pix { position: relative; width: 12px; height: 12px; }
.chip-x:hover::before { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.chip-x:focus-visible { outline: none; }
.chip-x:focus-visible::before { outline: 3px solid var(--focus); }
.chip-add { display: flex; gap: 8px; }

.savebar { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 10px); display: flex;
           flex-direction: column; gap: 8px; padding-top: 4px; z-index: 2; }
.savebar .btn { box-shadow: 0 10px 24px -12px rgba(120, 50, 20, 0.55); }

/* --- login and invite -------------------------------------------------------------------------------------------- */
.view-entrar, .view-convite { min-height: 100vh; justify-content: center; max-width: 440px; }
.auth { display: flex; flex-direction: column; gap: 20px; }
.auth-face { width: min(56vw, 200px); height: min(56vw, 200px); align-self: center; margin-bottom: 4px; }
.auth-text { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.auth-title { font-size: 30px; font-weight: 800; }
.auth-sub { color: var(--muted); }
.auth-foot { text-align: center; }

/* --- scenes: empty, waiting, error ------------------------------------------------------------------------------- */
.scene { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 12px; }
.scene-face { width: 108px; height: 108px; margin-bottom: 8px; }
.scene-title { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.scene-text { color: var(--muted); max-width: 26em; }
.scene .btn { margin-top: 10px; }
.scene-loading { padding: 48px 12px; }
.scene-loading .scene-face { width: 72px; height: 72px; }

/* --- Tampinha tab ------------------------------------------------------------------------------------------------ */
.picker { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.pick { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
        background: var(--paper); border: 2px solid var(--line); text-decoration: none; font-weight: 700; flex: none;
        min-height: 48px; }
.pick[aria-current="true"] { border-color: var(--ink); }
.pick-face { width: 32px; height: 32px; box-shadow: none; border-radius: 10px; }
.pet-head { display: flex; align-items: center; gap: 16px; }
.pet-head-face { width: 76px; height: 76px; }
.pet-head .page-title { font-size: 28px; }
.subtabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: var(--paper);
           border: 1px solid var(--line); border-radius: 999px; position: sticky; z-index: 3;
           top: calc(env(safe-area-inset-top, 0px) + 8px); box-shadow: var(--shadow); }
.subtab { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 999px;
          text-decoration: none; font-weight: 700; font-size: 15px; color: var(--muted); }
.subtab[aria-current="page"] { background: var(--coral); color: #2b2118; }
.sub-body { display: flex; flex-direction: column; gap: 14px; }
.form-profile { gap: 14px; }

/* memories */
.mem-add { display: flex; flex-direction: column; gap: 12px; }
.mem-form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; gap: 12px; }
.mems .mem-form { border: 0; padding: 0; background: none; }
.cat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cat-head { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
            padding: 12px 16px; min-height: 52px; cursor: pointer; }
.cat-head::-webkit-details-marker { display: none; }
.cat-head::after { content: ""; width: 10px; height: 10px; border-right: 3px solid var(--muted); border-bottom: 3px solid var(--muted);
                   transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform 160ms ease; }
.cat[open] > .cat-head::after { transform: rotate(-135deg); margin-top: 4px; }
.cat-title { font-family: var(--font-display); font-weight: 800; font-size: 18px; flex: 1; }
.count { min-width: 28px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--cream); color: var(--muted);
         font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.cat > .empty { padding: 0 16px 14px; }
.cat-saude .cat-title::before { content: "♥ "; color: var(--berry); }
.mems { list-style: none; margin: 0; padding: 0 16px 6px; }
.mem { padding: 12px 0; display: flex; flex-direction: column; gap: 4px; }
.mem + .mem { border-top: 1px dashed var(--line); }
.mem-text { font-size: 16px; overflow-wrap: anywhere; }
.mem-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.tag { background: var(--honey-soft); color: var(--ink); border-radius: 6px; padding: 1px 8px; font-weight: 700; }
.mem-actions { display: flex; gap: 8px; margin: -4px 0 -8px -6px; }
.hist { list-style: none; margin: 0; padding: 0 16px 10px; }
.hist-row { padding: 10px 0; }
.hist-row + .hist-row { border-top: 1px dashed var(--line); }
.hist-meta { font-size: 13px; color: var(--muted); }
.hist-meta strong { color: var(--ink); }
.hist-text { overflow-wrap: anywhere; }
.hist-text s { color: var(--muted); }
.banner { display: flex; gap: 12px; align-items: center; background: var(--honey-soft); border: 1px solid var(--honey);
          border-radius: var(--radius); padding: 12px 14px; }
.banner-face { width: 48px; height: 48px; }

/* conversation */
.chat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.bubble-row { display: flex; align-items: flex-end; gap: 8px; }
.from-me { justify-content: flex-end; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 20px; overflow-wrap: anywhere; font-size: 16px; }
.from-me .bubble { background: var(--coral); color: #2b2118; border-bottom-right-radius: 6px; }
.from-her .bubble { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble-face { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 0 0 2px var(--bezel); }

/* diary: pages of a lined notebook */
.diary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.page {
  background-color: var(--paper);
  background-image: linear-gradient(to bottom, transparent 31px, var(--line) 31px, var(--line) 32px, transparent 32px);
  background-size: 100% 32px;
  background-position: 0 14px;
  border: 1px solid var(--line);
  border-left: 6px double var(--coral);
  border-radius: 6px var(--radius) var(--radius) 6px;
  padding: 14px 18px 18px 20px;
}
.page-day { font-size: 17px; font-weight: 800; line-height: 32px; text-transform: none; }
.page-text { font-family: var(--font-diary); font-style: italic; font-size: 18px; line-height: 32px; }

/* Eu */
.groups { list-style: none; margin: 0; padding: 0; }
.group-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.group-row + .group-row { border-top: 1px dashed var(--line); }
.group-emoji { font-size: 26px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
               background: var(--cream); border-radius: 12px; flex: none; }
.group-info { flex: 1; min-width: 0; }
.group-name { font-weight: 700; }

/* --- tab bar ----------------------------------------------------------------------------------------------------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs-list { list-style: none; margin: 0 auto; padding: 0 4px; max-width: 720px; display: flex; }
.tabs-list li { flex: 1; min-width: 0; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
       height: var(--tab-h); text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 700; }
.tab-icon { position: relative; display: flex; align-items: center; justify-content: center; width: 52px; height: 30px;
            border-radius: 999px; transition: background-color 150ms ease; }
.tab-icon .pix { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] .tab-icon { background: var(--coral); color: #2b2118; }
.tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-size: 11px;
             letter-spacing: -0.01em; }
.tabs-list li + li { margin-left: -2px; }
.badge { position: absolute; top: -4px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
         background: var(--berry); color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center;
         box-shadow: 0 0 0 2px var(--paper); }
@media (prefers-color-scheme: dark) { .badge { color: #2b0d16; } }

/* --- toasts: the Tampinha talking ------------------------------------------------------------------------------- */
.toasts { position: fixed; left: 0; right: 0; z-index: 30; display: flex; flex-direction: column; align-items: center;
          gap: 8px; padding: 0 16px; pointer-events: none;
          bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px); }
body:not(.has-tabs) .toasts { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 12px); }  /* never over the form's button */
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; width: fit-content;
         background: var(--ink); color: var(--cream); padding: 8px 16px 8px 8px; border-radius: 18px 18px 18px 6px;
         box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5); font-weight: 600; animation: toast-in 220ms ease-out both; }
.toast-error { background: var(--berry); color: #fff; }
@media (prefers-color-scheme: dark) { .toast { background: #f4e7da; color: #2b2118; } .toast-error { background: var(--berry); color: #2b0d16; } }
.toast-face { width: 32px; height: 32px; border-radius: 9px; box-shadow: none; }
.toast-out { animation: toast-out 300ms ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* --- the confirmation sheet ------------------------------------------------------------------------------------ */
.sheet { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: 100%; width: 100%; max-height: 100%;
         margin: auto auto 0; }
.sheet::backdrop { background: rgba(29, 23, 18, 0.55); }
.sheet-inner { margin: 0 auto; max-width: 560px; background: var(--paper); border-radius: 24px 24px 0 0;
               padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column;
               align-items: center; text-align: center; gap: 10px; animation: sheet-up 220ms cubic-bezier(.2, .8, .2, 1) both; }
.sheet-face { width: 64px; height: 64px; margin-bottom: 4px; }
.sheet-title { font-size: 22px; font-weight: 800; }
.sheet-text { color: var(--muted); overflow-wrap: anywhere; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 10px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- wider screens ------------------------------------------------------------------------------------------------ */
@media (min-width: 600px) {
  .view { padding-top: 36px; gap: 22px; }
  .page-title { font-size: 36px; }
  .pet { grid-template-columns: 140px 1fr; grid-template-areas: "face info" "face actions"; align-items: start; }
  .pet-screen { width: 140px; height: 140px; }
  .pet-actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .pet-actions .btn { white-space: nowrap; }
  .pets-one .pet { grid-template-columns: 220px 1fr; grid-template-areas: "face info" "face actions"; justify-items: start;
                   text-align: left; align-items: center; }
  .pets-one .pet-screen { width: 220px; height: 220px; }
  .pets-one .pet-info { align-items: flex-start; }
  .pets-one .pet-hungry { align-self: flex-start; }
  .sheet { margin: auto; }
  .sheet-inner { border-radius: 24px; }
}

@media (max-width: 440px) {
  .pet-actions .btn { padding: 10px 10px; font-size: 15px; }
  .pet-actions .btn .pix { display: none; }
  .tabs-list { padding: 0; }
  .tab-icon { width: 46px; }
}

@media (max-width: 360px) {
  .two, .hours { grid-template-columns: 1fr; }
  .pet { grid-template-columns: 88px 1fr; }
  .pet-screen { width: 88px; height: 88px; }
  .tab-label { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================================================================================================================
   Part 2: recados, lembretes, gestão
   ================================================================================================================ */
.page-head-row { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head-row > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.seg-box .seg-row { background: var(--paper); }
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
        display: flex; flex-direction: column; gap: 8px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-left: -6px; }
.card-actions .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* recados */
.note.is-unread { border-left: 6px solid var(--coral); padding-left: 12px; }
.note-head { font-size: 15px; }
.note-when { color: var(--muted); }
.note-text { font-size: 17px; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-sched { font-size: 14px; color: var(--muted); }
.note-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.note-foot .card-actions { margin-left: 0; }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px;
          font-size: 13px; font-weight: 800; white-space: nowrap; border: 1px solid transparent; }
.st-pending { background: var(--cream); color: var(--muted); border-color: var(--line-strong); }
.st-said { background: var(--coral-soft); color: var(--ink); }
.st-heard { background: color-mix(in srgb, var(--mint) 18%, var(--paper)); color: var(--ink); border-color: var(--mint); }
.st-missed { background: var(--berry-soft); color: var(--berry); }
.st-read { background: transparent; color: var(--mint); border-color: var(--mint); }
.recipients { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px dashed var(--line); display: flex;
              flex-direction: column; gap: 6px; }
.recipient { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.recipient-name { font-weight: 600; margin-right: auto; }
.quote { margin: 0; padding: 10px 14px; border-left: 4px solid var(--coral); background: var(--cream); border-radius: 0 12px 12px 0;
         display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.quote-who { font-weight: 800; font-size: 14px; }

/* recipient picker */
.pick-list { display: flex; flex-direction: column; border: 2px solid var(--line-strong); border-radius: var(--radius-sm);
             max-height: 260px; overflow-y: auto; background: var(--paper); }
.pick-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 52px; cursor: pointer; }
.pick-row + .pick-row { border-top: 1px dashed var(--line); }
.pick-input { width: 20px; height: 20px; accent-color: var(--coral); flex: none; margin: 0; }
.pick-row:has(.pick-input:checked) { background: var(--coral-soft); }
.pick-main { display: flex; flex-direction: column; min-width: 0; }
.pick-name { font-weight: 700; overflow-wrap: anywhere; }
.pick-sub { font-size: 13px; color: var(--muted); }
.pick-hint { font-size: 13px; color: var(--berry); font-weight: 600; }
.picked { font-weight: 700; min-height: 1.5em; }

/* lembretes */
.days { display: flex; flex-direction: column; gap: 20px; }
.day { display: flex; flex-direction: column; gap: 10px; }
.day-title { font-size: 20px; font-weight: 800; padding-left: 2px; }
.reminder { flex-direction: row; align-items: flex-start; gap: 14px; }
.reminder-time { font-family: var(--font-display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums;
                 min-width: 3.2em; padding-top: 1px; }
.reminder-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.reminder-text { font-size: 17px; overflow-wrap: anywhere; }
.reminder-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--muted); }
.reminder.is-late { background: transparent; border-style: dashed; }
.reminder.is-late .reminder-time, .reminder.is-late .reminder-text { color: var(--muted); }
.late { color: var(--berry); font-weight: 700; }
.counter.warn { color: var(--berry); font-weight: 700; }

/* form sheets */
.sheet-panel .sheet-inner-panel { align-items: stretch; text-align: left; max-height: min(88vh, 760px); overflow-y: auto;
                                  padding-top: 14px; gap: 14px; }
.sheet-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: -14px; background: var(--paper);
             padding: 4px 0 8px; z-index: 1; }
.sheet-bar .sheet-title { flex: 1; font-size: 21px; }
.sheet-mini { width: 36px; height: 36px; border-radius: 10px; box-shadow: none; }
.sheet-close { width: 44px; height: 44px; border: 0; border-radius: 999px; background: var(--cream); color: var(--ink);
               display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.sheet-close .pix { width: 14px; height: 14px; }
.panel-sheet-body .scene { padding: 8px 0; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label-row .btn-text { min-height: 36px; padding: 4px 6px; }
.link-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.actions-fill { display: grid; grid-template-columns: 1fr 1fr; }
.actions-fill > :only-child { grid-column: 1 / -1; }
.input-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 22px; letter-spacing: 0.2em; text-transform: uppercase;
            max-width: 10ch; }
.input-emoji { max-width: 6ch; font-size: 24px; text-align: center; }
.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper);
              font-size: 22px; cursor: pointer; }
.emoji-pick:hover { border-color: var(--coral); }
.checks { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; min-width: 0; }
.checks > .label { padding: 0; margin-bottom: 6px; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 2px; cursor: pointer; }
.check-row + .check-row { border-top: 1px dashed var(--line); }
.check-row span:first-of-type { flex: 1; font-weight: 600; }
.check-input { width: 22px; height: 22px; accent-color: var(--coral); margin: 0; flex: none; }

/* gestão */
.person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.person-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; overflow-wrap: anywhere; }
.person-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-off { background: var(--berry-soft); color: var(--berry); }
.tag-me { background: var(--coral-soft); }
.person.is-off { opacity: 0.75; }
.device { flex-direction: row; align-items: flex-start; gap: 14px; }
.device-face { width: 64px; height: 64px; border-radius: 18px; }
.device-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.device-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; color: var(--muted); font-weight: 600; }
.group-card .group-row { padding: 0; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--cream); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 700; }
.tile-value { font-family: var(--font-display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.tile-note { font-size: 12px; color: var(--muted); }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles-3 .tile { padding: 10px; }
.tiles-3 .tile-value { font-size: 16px; white-space: nowrap; }
.budget { display: flex; flex-direction: column; gap: 8px; }
.budget-line { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 15px; }
.budget-over { color: var(--berry); font-weight: 800; }
.budget-warn { color: #a85d00; font-weight: 700; }
@media (prefers-color-scheme: dark) { .budget-warn { color: var(--honey); } }
.bar { display: block; width: 100%; height: 14px; }
.bar-thin { height: 8px; }
.bar-track { fill: var(--cream); stroke: var(--line-strong); stroke-width: 0.4; }
.bar-ok .bar-fill { fill: var(--mint); }
.bar-warn .bar-fill { fill: #f08a24; }
.bar-over .bar-fill { fill: var(--berry); }
.spend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.spend-row { display: flex; flex-direction: column; gap: 4px; }
.spend-head { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }

@media (min-width: 600px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 360px) {
  .tiles-3 { grid-template-columns: 1fr; }
}

.check-row.is-off { color: var(--muted); cursor: default; }
.reminder.is-missed { background: transparent; border-style: dashed; }
.reminder.is-missed .reminder-time, .reminder.is-missed .reminder-text { color: var(--muted); }
.reminder.is-missed .reminder-text { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.day-missed .hint { margin-top: -6px; }
