/* ==========================================================================
   PetCare — Design system & app shell
   Παλέτα: moss (πράσινο) + honey (μελί) πάνω σε ζεστό paper.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg:          #F5F4EF;
  --surface:     #FFFFFF;
  --surface-2:   #FBFAF6;
  --ink:         #1C241C;
  --muted:       #5E6A5C;
  --faint:       #8A9385;
  --line:        #E6E3DA;

  --primary:     #5A7A38;
  --primary-ink: #43601F;
  --primary-soft:#EAF0DF;
  --accent:      #CC8A2A;
  --accent-soft: #F6EAD0;
  --danger:      #B8492C;
  --danger-soft: #F6E0D8;
  --ok:          #4E7D4E;

  --r-sm: 8px;  --r: 12px;  --r-lg: 18px;  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(28,36,28,.06), 0 1px 1px rgba(28,36,28,.04);
  --shadow-2: 0 6px 20px rgba(28,36,28,.10), 0 2px 6px rgba(28,36,28,.06);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --nav-w: 248px;
  --topbar-h: 60px;
  --bottom-h: 64px;
  --page-max: 920px;

  --ease: cubic-bezier(.2,.7,.2,1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #14160F;
  --surface:     #1C1F16;
  --surface-2:   #22261B;
  --ink:         #EBEADF;
  --muted:       #A2AA97;
  --faint:       #7C846F;
  --line:        #2E3325;

  --primary:     #9BBE6C;
  --primary-ink: #B4D189;
  --primary-soft:#26301A;
  --accent:      #E3B457;
  --accent-soft: #352C18;
  --danger:      #E1856A;
  --danger-soft: #3A241C;
  --ok:          #86B884;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 8px 24px rgba(0,0,0,.5);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body { height: 100%; overflow-x: hidden; overscroll-behavior: none; }
img { max-width: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ==========================================================================
   Layout
   ========================================================================== */
.app { min-height: 100%; display: grid; }

/* --- Desktop: sidebar + content --- */
@media (min-width: 860px) {
  .app { grid-template-columns: var(--nav-w) 1fr; }
}

/* ---------- Sidebar (desktop) ---------- */
.sidebar {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; height: 100vh;
}
@media (min-width: 860px) { .sidebar { display: flex; } }

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--primary); display: grid; place-items: center;
  box-shadow: var(--shadow-1);
}
.brand__mark svg { width: 20px; height: 20px; }
.brand__name { font-weight: 700; letter-spacing: -.01em; }
.brand__sub { font-size: 11px; color: var(--faint); letter-spacing: .04em; text-transform: uppercase; }

.navlink {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r);
  color: var(--muted); text-decoration: none; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.navlink svg { width: 20px; height: 20px; flex: none; opacity: .9; }
.navlink:hover { background: var(--surface-2); color: var(--ink); }
.navlink.is-active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 600; }
.navlink.is-active svg { opacity: 1; }
.nav-spacer { flex: 1; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
.topbar__mobile-brand { display: flex; align-items: center; gap: 9px; }
.topbar__mobile-brand .brand__mark { width: 30px; height: 30px; border-radius: 9px; }
.topbar__mobile-brand .brand__mark svg { width: 17px; height: 17px; }
@media (min-width: 860px) { .topbar__mobile-brand { display: none; } }

.topbar__title { font-weight: 700; letter-spacing: -.01em; font-size: 1.05rem; display: none; }
@media (min-width: 860px) { .topbar__title { display: block; } }
.topbar__spacer { flex: 1; }

/* Pet switcher */
.petswitch {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-1); max-width: 220px;
}
.petswitch:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.petswitch__avatar {
  width: 30px; height: 30px; border-radius: var(--r-pill); flex: none;
  object-fit: cover; background: var(--primary-soft);
  display: grid; place-items: center; color: var(--primary-ink);
}
.petswitch__avatar svg { width: 16px; height: 16px; }
.petswitch__name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.petswitch__chev { color: var(--faint); flex: none; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r); flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); transition: .15s var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- Main / pages ---------- */
.content { min-width: 0; padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom) + 8px); }
@media (min-width: 860px) { .content { padding-bottom: 40px; } }

.page { max-width: var(--page-max); margin: 0 auto; padding: 22px 16px 8px; }
.page[hidden] { display: none; }
.page-head { margin: 4px 2px 18px; }
.page-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--line);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
@media (min-width: 860px) { .bottomnav { display: none; } }
.bnav {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: none; color: var(--faint); font-size: 10.5px; font-weight: 600;
  transition: color .15s var(--ease);
}
.bnav svg { width: 22px; height: 22px; }
.bnav.is-active { color: var(--primary-ink); }
.bnav.is-active svg { transform: translateY(-1px); }

/* ==========================================================================
   Components
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
}
.card--pad { padding: 18px; }

.grid { display: grid; gap: 14px; }
@media (min-width: 620px) { .grid--2 { grid-template-columns: 1fr 1fr; } }

.stat { padding: 16px 18px; }
.stat__label { font-size: .78rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.stat__value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat__value small { font-size: .85rem; color: var(--muted); font-weight: 500; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--faint); margin: 26px 2px 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r); font-weight: 600; font-size: .92rem;
  border: 1px solid transparent; background: var(--surface-2); color: var(--ink);
  transition: .15s var(--ease);
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { background: var(--line); }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-1); }
:root[data-theme="dark"] .btn--primary { color: #10130c; }
.btn--primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: .85rem; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill); font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.chip--accent { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 70%, var(--ink)); border-color: transparent; }
.chip--primary { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }

/* Empty state */
.empty { text-align: center; padding: 44px 24px; }
.empty__art {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink);
}
.empty__art svg { width: 30px; height: 30px; }
.empty h2 { margin: 0 0 6px; font-size: 1.15rem; letter-spacing: -.01em; }
.empty p { margin: 0 auto 18px; color: var(--muted); max-width: 34ch; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); background: var(--surface);
}
.field textarea { resize: vertical; min-height: 78px; }
.field-row { display: grid; gap: 12px; }
@media (min-width: 520px) { .field-row--2 { grid-template-columns: 1fr 1fr; } }

/* Avatar picker */
.avatar-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.avatar-pick__img {
  width: 72px; height: 72px; border-radius: 20px; object-fit: cover; flex: none;
  background: var(--primary-soft); display: grid; place-items: center; color: var(--primary-ink);
  border: 1px solid var(--line);
}
.avatar-pick__img svg { width: 30px; height: 30px; }

/* ---------- Modal / sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,22,15,.44);
  backdrop-filter: blur(2px); display: grid; place-items: end center;
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease);
}
.scrim.is-open { opacity: 1; pointer-events: auto; }
@media (min-width: 620px) { .scrim { place-items: center; } }

.sheet {
  width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-2); padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(16px); transition: transform .24s var(--ease);
}
.scrim.is-open .sheet { transform: none; }
@media (min-width: 620px) { .sheet { border-radius: var(--r-lg); transform: scale(.98); }
  .scrim.is-open .sheet { transform: none; } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet__head h3 { margin: 0; font-size: 1.15rem; letter-spacing: -.01em; }
.sheet__actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet__actions .btn { flex: 1; }

/* Pet list rows (in switcher sheet) */
.petrow {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; border-radius: var(--r); border: 1px solid transparent; background: none;
  text-align: left; transition: background .15s var(--ease);
}
.petrow:hover { background: var(--surface-2); }
.petrow.is-active { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); background: var(--primary-soft); }
.petrow__avatar { width: 40px; height: 40px; border-radius: var(--r-pill); object-fit: cover; flex: none;
  background: var(--surface-2); display: grid; place-items: center; color: var(--primary-ink); }
.petrow__avatar svg { width: 20px; height: 20px; }
.petrow__meta { min-width: 0; }
.petrow__name { font-weight: 600; }
.petrow__sub { font-size: .8rem; color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-h) + 20px); transform: translateX(-50%) translateY(20px);
  z-index: 80; background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: var(--r-pill); font-size: .88rem; font-weight: 600;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: .25s var(--ease);
}
@media (min-width: 860px) { .toast { bottom: 28px; } }
.toast.is-show { opacity: 1; transform: translateX(-50%); }

/* Storage badge */
.storage-note {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-top: 14px;
  border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line);
  font-size: .82rem; color: var(--muted);
}
.storage-note svg { width: 18px; height: 18px; flex: none; color: var(--primary-ink); }
.storage-note b { color: var(--ink); font-weight: 600; }

/* Pet summary cards (dashboard overview) */
.petcards { display: grid; gap: 14px; }
@media (min-width: 620px) { .petcards { grid-template-columns: 1fr 1fr; } }

.petcard {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 16px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}
.petcard:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); box-shadow: var(--shadow-2); }
.petcard:active { transform: translateY(1px); }
.petcard__top { display: flex; align-items: center; gap: 13px; }
.petcard__avatar {
  width: 54px; height: 54px; border-radius: 16px; object-fit: cover; flex: none;
  background: var(--primary-soft); display: grid; place-items: center; color: var(--primary-ink);
}
.petcard__avatar svg { width: 26px; height: 26px; }
.petcard__id { min-width: 0; flex: 1; }
.petcard__name { font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 7px; }
.petcard__sub { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.petcard__go { color: var(--faint); flex: none; }
.petcard__stats { display: flex; gap: 8px; margin-top: 14px; }
.petcard__stat { flex: 1; background: var(--surface-2); border-radius: var(--r); padding: 9px 11px; }
.petcard__stat b { display: block; font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.petcard__stat span { font-size: .72rem; color: var(--faint); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }

.overview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 2px 18px; }
.overview-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.overview-head .count { color: var(--muted); font-size: .9rem; font-weight: 600; }

.soon { color: var(--faint); font-size: .85rem; }
/* ---- Health module ---- */
.segnav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0; scrollbar-width: none; }
.segnav::-webkit-scrollbar { display: none; }
.seg {
  flex: none; padding: 8px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-weight: 600; font-size: .86rem; white-space: nowrap; transition: .15s var(--ease);
}
.seg:hover { color: var(--ink); }
.seg.is-active { background: var(--primary); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .seg.is-active { color: #10130c; }

.reclist { display: flex; flex-direction: column; gap: 10px; }
.rec {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: 13px 14px; transition: border-color .15s var(--ease);
}
.rec:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.rec__main { flex: 1; min-width: 0; }
.rec__title { font-weight: 600; }
.rec__meta { font-size: .82rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec__go { color: var(--faint); flex: none; }
.chip--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .field { margin-bottom: 0; }
.col-full { grid-column: 1 / -1; }
@media (max-width: 519px) { .form-grid { grid-template-columns: 1fr; } }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.files .chip svg { width: 14px; height: 14px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }

/* Attention strip (dashboard) */
.attn {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 12px 14px; background: var(--surface); border: none; border-bottom: 1px solid var(--line);
}
.attn:last-child { border-bottom: none; }
.attn:hover { background: var(--surface-2); }
.attn__main { flex: 1; min-width: 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.attn__dot.overdue { background: var(--danger); }

/* ---- Calendar ---- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 2px 2px 14px; }
.cal-nav h2 { font-size: 1.05rem; margin: 0; letter-spacing: -.01em; text-transform: capitalize; }
.calgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: .68rem; color: var(--faint); font-weight: 700; letter-spacing: .04em; padding: 2px 0 6px; }
.cal-cell {
  aspect-ratio: 1; border-radius: var(--r); border: 1.5px solid transparent;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 7px;
  background: var(--surface-2); color: var(--ink); transition: background .12s var(--ease);
}
.cal-cell:hover { background: var(--line); }
.cal-cell.dim { background: transparent; color: var(--faint); }
.cal-cell.today { border-color: var(--primary); }
.cal-cell .d { font-size: .84rem; font-weight: 600; line-height: 1; }
.cal-dots { display: flex; gap: 3px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); display: block; }
.cal-dots i.t-appointment { background: var(--primary); }
.cal-dots i.t-medication { background: var(--danger); }
.cal-dots i.t-grooming { background: var(--accent); }
.cal-dots i.t-feeding { background: #4E7DB0; }
.cal-dots i.t-other { background: var(--faint); }
.cal-dots i.k-vaccine { background: #4E7DB0; }
.cal-dots i.k-deworm { background: var(--accent); }
.cal-dots i.k-vet { background: var(--primary); }
.cal-dots i.k-med { background: var(--danger); }

.agenda { display: flex; flex-direction: column; gap: 10px; }
.evtype { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-ink); }
.evtype svg { width: 18px; height: 18px; }

/* ---- Pet nav arrows + stacked health sections ---- */
.petnav svg { width: 18px; height: 18px; }
#pet-prev svg { transform: rotate(180deg); }
@media (max-width: 520px) { .petswitch { max-width: 140px; } .petnav { width: 34px; height: 34px; } }

#health-body { display: flex; flex-direction: column; gap: 14px; }
.hsec { scroll-margin-top: 78px; }
.hsec__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.hsec__head h3 { margin: 0; font-size: 1.02rem; letter-spacing: -.01em; }

/* ---- Expenses ---- */
.exp-stats { display: flex; gap: 12px; margin: 16px 0 4px; }
.exp-stat { flex: 1; }
.exp-stat .l { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.exp-stat .v { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.catbars { display: flex; flex-direction: column; gap: 11px; margin-top: 16px; }
.catbar__top { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 5px; }
.catbar__top span:first-child { color: var(--muted); font-weight: 600; }
.catbar__track { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.catbar__track i { display: block; height: 100%; border-radius: var(--r-pill); }
.cat-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.cat-ic svg { width: 18px; height: 18px; }
.exp-amt { font-weight: 700; letter-spacing: -.01em; flex: none; }

/* ---- Notes ---- */
.notelist { display: flex; flex-direction: column; gap: 12px; }
.note { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 15px; transition: border-color .15s var(--ease); }
.note:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.note__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.note__title { font-weight: 700; letter-spacing: -.01em; margin-bottom: 4px; }
.note__body { color: var(--muted); font-size: .9rem; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- Gallery ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.gphoto { aspect-ratio: 1; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; color: var(--faint); padding: 0; }
.gphoto svg { width: 24px; height: 24px; }
.gphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-view { border-radius: var(--r); overflow: hidden; background: #000; margin-bottom: 16px; }
.photo-view img { width: 100%; display: block; max-height: 58vh; object-fit: contain; }

/* ---- Medical report (print to PDF) ---- */
#report-root { display: none; }
.rep { color: #111; font-family: var(--font); padding: 28px 24px; max-width: 780px; margin: 0 auto; }
.rep-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.rep-mark { font-weight: 800; color: #5A7A38; letter-spacing: -.01em; }
.rep h1 { font-size: 21px; margin: 0 0 2px; letter-spacing: -.01em; }
.rep-sub { color: #555; font-size: 12px; margin-bottom: 20px; }
.rep h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: #333; border-bottom: 1.5px solid #cfcfcf; padding-bottom: 4px; margin: 22px 0 8px; }
.rep-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; font-size: 12.5px; }
.rep-grid div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dotted #ddd; padding: 4px 0; }
.rep-grid span:first-child { color: #666; }
.rep-grid span:last-child { font-weight: 600; text-align: right; }
.rep table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 4px; }
.rep th, .rep td { text-align: left; padding: 5px 8px; border-bottom: 1px solid #e4e4e4; vertical-align: top; }
.rep th { background: #f3f3f0; font-weight: 600; }
.rep-empty { color: #999; font-size: 11.5px; font-style: italic; margin: 2px 0 0; }
.rep-foot { margin-top: 26px; color: #888; font-size: 10.5px; border-top: 1px solid #cfcfcf; padding-top: 8px; }
.rep-weight { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 8px; }

@media print {
  body { background: #fff; }
  #app, .scrim, .toast { display: none !important; }
  #report-root { display: block !important; }
  .rep section, .rep table { page-break-inside: avoid; }
}

/* ---- Auth screen + cloud settings ---- */
.authscreen { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.authcard { width: 100%; max-width: 380px; }
.authcard .brand { justify-content: center; padding: 0 0 20px; }
.auth-err { color: var(--danger); font-size: .85rem; margin: 4px 2px 0; min-height: 18px; }
.cloud-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.cloud-status { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.cloud-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.cloud-status.on .dot { background: var(--ok); }

.hide { display: none !important; }

/* ========================================================================== 
   PetCare Premium UI Refresh — warm modern veterinary aesthetic
   Visual-only layer. No functional selectors or behavior are changed.
   ========================================================================== */

:root {
  --bg: #F6F3ED;
  --surface: #FFFEFB;
  --surface-2: #F2EEE7;
  --surface-3: #ECE8DF;
  --ink: #20332D;
  --muted: #66766F;
  --faint: #98A39D;
  --line: #E4DED4;

  --primary: #3D725F;
  --primary-ink: #285244;
  --primary-soft: #E3EEE9;
  --accent: #D58E64;
  --accent-soft: #F6E7DD;
  --danger: #B85C4B;
  --danger-soft: #F7E5E1;
  --ok: #5B8064;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(43, 62, 55, .035), 0 8px 22px rgba(43, 62, 55, .05);
  --shadow-2: 0 18px 50px rgba(43, 62, 55, .12), 0 4px 14px rgba(43, 62, 55, .06);
  --shadow-soft: 0 22px 70px rgba(45, 66, 57, .09);

  --font: Inter, Aptos, "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --nav-w: 272px;
  --topbar-h: 76px;
  --bottom-h: 72px;
  --page-max: 1120px;
}

:root[data-theme="dark"] {
  --bg: #17211E;
  --surface: #1E2B27;
  --surface-2: #26342F;
  --surface-3: #2D3C36;
  --ink: #F1F5F2;
  --muted: #B6C2BC;
  --faint: #899991;
  --line: #34443E;
  --primary: #85B49F;
  --primary-ink: #B7D9CA;
  --primary-soft: #2B4037;
  --accent: #E3A37C;
  --accent-soft: #49372F;
  --danger: #E38B79;
  --danger-soft: #4B302B;
  --ok: #8EB99A;
  --shadow-1: 0 10px 28px rgba(0,0,0,.16);
  --shadow-2: 0 26px 70px rgba(0,0,0,.28);
  --shadow-soft: 0 24px 70px rgba(0,0,0,.18);
}

html { background: var(--bg); }
body {
  font-size: 15px;
  letter-spacing: -.005em;
  background:
    radial-gradient(circle at 76% 8%, color-mix(in srgb, var(--accent-soft) 75%, transparent) 0, transparent 22rem),
    radial-gradient(circle at 25% 95%, color-mix(in srgb, var(--primary-soft) 65%, transparent) 0, transparent 25rem),
    var(--bg);
}

button, input, select, textarea { letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* --- App frame --- */
@media (min-width: 860px) {
  .app { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
}

.sidebar {
  padding: 24px 18px 20px;
  gap: 7px;
  border-right: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.11), transparent 19rem),
    linear-gradient(180deg, #315E50 0%, #254C41 100%);
  color: #fff;
  box-shadow: inset -1px 0 rgba(255,255,255,.04);
}
:root[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #263E36 0%, #1C312A 100%);
}

.brand { gap: 12px; padding: 2px 10px 28px; }
.brand__mark {
  width: 42px; height: 42px; border-radius: 15px;
  background: rgba(255,255,255,.15);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 10px 24px rgba(14,38,30,.16);
}
.brand__mark svg { width: 22px; height: 22px; }
.brand__name { font-size: 1.08rem; font-weight: 760; letter-spacing: -.03em; }
.brand__sub { margin-top: 1px; color: rgba(255,255,255,.58); font-size: 9px; letter-spacing: .16em; }
.sidebar .brand__name { color: #fff; }
.sidebar .brand__sub { color: rgba(255,255,255,.56); }

.sidebar .navlink {
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 14px;
  color: rgba(255,255,255,.68);
  font-weight: 590;
}
.sidebar .navlink svg { width: 20px; height: 20px; opacity: .8; }
.sidebar .navlink:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .navlink.is-active {
  color: #fff;
  background: rgba(255,255,255,.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  font-weight: 660;
}
.sidebar .navlink.is-active svg { opacity: 1; }

.content { min-width: 0; }

.topbar {
  height: var(--topbar-h);
  padding: 0 22px;
  gap: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px) saturate(1.25);
}
@media (min-width: 860px) { .topbar { padding: 0 34px; } }
.topbar__title { font-size: .95rem; font-weight: 650; color: var(--muted); letter-spacing: 0; }
.topbar__mobile-brand .brand__mark {
  background: var(--primary);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 22%, transparent);
}

.petswitch {
  min-height: 46px;
  gap: 10px;
  padding: 5px 14px 5px 5px;
  max-width: 250px;
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 8px 24px rgba(43, 62, 55, .055);
}
.petswitch:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); box-shadow: var(--shadow-1); }
.petswitch__avatar { width: 36px; height: 36px; background: var(--primary-soft); }
.petswitch__name { font-size: .88rem; font-weight: 680; }
.petswitch__chev { display: flex; align-items: center; }
.petswitch__chev svg { width: 16px; height: 16px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 13px;
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 6px 18px rgba(43, 62, 55, .035);
}
.icon-btn:hover { background: var(--surface); color: var(--primary-ink); border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); transform: translateY(-1px); }

.page { padding: 34px 22px 28px; }
@media (min-width: 860px) { .page { padding: 42px 42px 54px; } }
.page-head { margin: 0 0 24px; }
.page-head h1, .overview-head h1 {
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  line-height: 1.1;
  font-weight: 760;
  letter-spacing: -.045em;
}
.page-head p { margin-top: 7px; color: var(--muted); font-size: .94rem; }

.overview-head { margin: 0 0 24px; align-items: center; }
.overview-head .count {
  padding: 7px 11px;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-size: .78rem;
  font-weight: 700;
}

/* --- Premium cards --- */
.card {
  border-color: color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  box-shadow: var(--shadow-1);
}
.card--pad { padding: 22px; }
@media (min-width: 700px) { .card--pad { padding: 26px; } }

.grid { gap: 16px; }
.section-title {
  margin: 30px 2px 12px;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 760;
  letter-spacing: .10em;
}
.section-title::after { background: linear-gradient(90deg, var(--line), transparent); }

/* --- Buttons --- */
.btn {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 13px;
  font-size: .89rem;
  font-weight: 680;
  background: var(--surface-2);
  transition: transform .14s var(--ease), box-shadow .14s var(--ease), background .14s var(--ease), border-color .14s var(--ease);
}
.btn:hover { transform: translateY(-1px); background: var(--surface-3); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 22%, transparent);
}
:root[data-theme="dark"] .btn--primary { color: #16211D; }
.btn--primary:hover { background: color-mix(in srgb, var(--primary) 90%, #15352b); box-shadow: 0 13px 28px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn--ghost { background: color-mix(in srgb, var(--surface) 82%, transparent); border-color: var(--line); }
.btn--danger { background: var(--danger-soft); border-color: transparent; }
.btn--sm { min-height: 40px; padding: 8px 13px; }

/* --- Chips / status --- */
.chip {
  padding: 5px 10px;
  border-color: transparent;
  background: var(--surface-2);
  font-size: .74rem;
  font-weight: 700;
}
.chip--accent { background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 76%, var(--ink)); }
.chip--primary { background: var(--primary-soft); color: var(--primary-ink); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }

/* --- Dashboard: photo-forward pet cards --- */
.petcards { gap: 18px; }
@media (min-width: 680px) { .petcards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.petcard {
  min-height: 190px;
  padding: 20px;
  border-color: color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 24px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 98%, transparent), color-mix(in srgb, var(--primary-soft) 22%, var(--surface)));
  box-shadow: var(--shadow-1);
  overflow: hidden;
  position: relative;
}
.petcard::after {
  content: "";
  position: absolute; width: 120px; height: 120px; right: -44px; bottom: -56px;
  border-radius: 50%; background: color-mix(in srgb, var(--accent-soft) 78%, transparent); opacity: .75; pointer-events: none;
}
.petcard:hover { border-color: color-mix(in srgb, var(--primary) 26%, var(--line)); box-shadow: var(--shadow-soft); transform: translateY(-3px); }
.petcard__top { gap: 16px; align-items: center; position: relative; z-index: 1; }
.petcard__avatar {
  width: 76px; height: 76px;
  border-radius: 22px;
  background: linear-gradient(145deg, var(--primary-soft), color-mix(in srgb, var(--accent-soft) 45%, var(--primary-soft)));
  border: 3px solid color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 10px 26px rgba(43,62,55,.10);
}
.petcard__avatar svg { width: 31px; height: 31px; }
.petcard__name { font-size: 1.18rem; font-weight: 760; letter-spacing: -.035em; }
.petcard__sub { margin-top: 3px; font-size: .83rem; }
.petcard__go { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.petcard__stats { gap: 10px; margin-top: 18px; position: relative; z-index: 1; }
.petcard__stat { padding: 11px 13px; border-radius: 15px; background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.petcard__stat b { font-size: .96rem; font-weight: 740; }
.petcard__stat span { font-size: .66rem; letter-spacing: .08em; color: var(--faint); }
.dot { width: 8px; height: 8px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent); }

/* --- Attention --- */
.attn { min-height: 56px; padding: 13px 16px; background: transparent; }
.attn:hover { background: color-mix(in srgb, var(--accent-soft) 30%, transparent); }
.attn__main { font-size: .87rem; }
.attn__dot { width: 9px; height: 9px; box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 12%, transparent); }
.attn__dot.overdue { box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 12%, transparent); }

/* --- Health module --- */
.segnav { gap: 9px; padding-bottom: 16px; }
.seg { padding: 9px 14px; border-color: color-mix(in srgb, var(--line) 86%, transparent); background: var(--surface); font-size: .82rem; }
.seg:hover { border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); color: var(--primary-ink); }
.seg.is-active { box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 20%, transparent); }

#health-body { gap: 18px; }
@media (min-width: 940px) {
  #health-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
.hsec { border-radius: 22px; }
.hsec__head { margin-bottom: 16px; }
.hsec__head h3 { font-size: 1rem; font-weight: 740; }
.reclist { gap: 9px; }
.rec { padding: 13px 14px; border-radius: 15px; box-shadow: none; background: var(--surface-2); border-color: transparent; }
.rec:hover { background: var(--surface-3); border-color: transparent; }
.rec__title { font-weight: 680; }
.rec__meta { font-size: .78rem; }

/* --- Forms --- */
.field { margin-bottom: 16px; }
.field label { margin: 0 0 7px 2px; color: var(--muted); font-size: .78rem; font-weight: 680; }
.field input, .field select, .field textarea {
  min-height: 46px;
  padding: 11px 13px;
  border-radius: 13px;
  border-color: color-mix(in srgb, var(--line) 90%, transparent);
  background: var(--surface-2);
  box-shadow: inset 0 1px rgba(255,255,255,.3);
}
.field textarea { min-height: 92px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: color-mix(in srgb, var(--primary) 72%, var(--line)); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent); }
.avatar-pick { gap: 18px; }
.avatar-pick__img { width: 88px; height: 88px; border-radius: 24px; border: 3px solid var(--surface); box-shadow: var(--shadow-1); }

/* --- Modal / sheets --- */
.scrim { background: rgba(20,34,29,.42); backdrop-filter: blur(7px); }
.sheet {
  max-width: 560px;
  max-height: 90vh;
  border-color: color-mix(in srgb, var(--line) 85%, transparent);
  border-radius: 28px 28px 0 0;
  padding: 24px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 30px 90px rgba(26,45,38,.22);
}
@media (min-width: 620px) { .sheet { border-radius: 28px; padding: 26px; } }
.sheet__head { margin-bottom: 20px; }
.sheet__head h3 { font-size: 1.22rem; font-weight: 760; letter-spacing: -.03em; }
.sheet__actions { margin-top: 22px; }
.petrow { min-height: 60px; padding: 10px 12px; border-radius: 15px; }
.petrow:hover { background: var(--surface-2); }
.petrow.is-active { border-color: transparent; background: var(--primary-soft); }
.petrow__avatar { width: 44px; height: 44px; background: var(--surface-2); }
.petrow__name { font-weight: 680; }

/* --- Calendar --- */
.cal-nav { margin-bottom: 18px; }
.cal-nav h2 { font-size: 1.12rem; font-weight: 740; }
.calgrid { gap: 7px; }
.cal-dow { padding-bottom: 8px; font-size: .64rem; letter-spacing: .10em; }
.cal-cell { border-radius: 14px; background: var(--surface-2); border-width: 1px; min-height: 58px; justify-content: flex-start; padding-top: 10px; }
.cal-cell:hover { background: var(--surface-3); }
.cal-cell.dim { opacity: .55; }
.cal-cell.today { border-color: var(--primary); background: var(--primary-soft); }
.cal-cell .d { font-size: .82rem; }
.cal-dots i { width: 5px; height: 5px; }
.evtype { width: 38px; height: 38px; border-radius: 12px; }

/* --- Expenses --- */
.exp-stats { gap: 14px; margin: 18px 0 8px; }
.exp-stat { padding: 15px 16px; border-radius: 16px; background: var(--surface-2); }
.exp-stat .l { font-size: .68rem; letter-spacing: .08em; }
.exp-stat .v { font-size: 1.55rem; font-weight: 760; }
.catbar__track { height: 9px; background: var(--surface-2); }
.cat-ic { width: 40px; height: 40px; border-radius: 13px; background: var(--primary-soft); color: var(--primary-ink); }
.exp-amt { font-weight: 760; }

/* --- Notes --- */
.notelist { gap: 14px; }
.note { padding: 18px; border-radius: 20px; box-shadow: var(--shadow-1); }
.note:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.note__head { margin-bottom: 10px; }
.note__title { font-size: 1rem; font-weight: 740; }
.note__body { line-height: 1.6; }

/* --- Gallery: editorial photo wall --- */
.gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gphoto { border: 0; border-radius: 20px; background: var(--surface-2); box-shadow: var(--shadow-1); transition: transform .16s var(--ease), box-shadow .16s var(--ease); }
.gphoto:hover { transform: translateY(-3px) scale(1.01); box-shadow: var(--shadow-soft); }
.photo-view { border-radius: 20px; }

/* --- Profile: hero treatment for the pet photo --- */
#page-profile .card { overflow: hidden; }
#page-profile .avatar-pick {
  margin: -26px -26px 22px !important;
  padding: 32px 28px 26px;
  background:
    radial-gradient(circle at 88% 18%, color-mix(in srgb, var(--accent-soft) 80%, transparent), transparent 10rem),
    linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--surface) 75%, var(--primary-soft)));
}
#page-profile .avatar-pick__img { width: 118px; height: 118px; border-radius: 32px; border-width: 5px; }
#page-profile .avatar-pick > div > div:first-child { font-size: 1.55rem !important; font-weight: 780 !important; letter-spacing: -.045em !important; }
#page-profile .avatar-pick .soon { margin-top: 5px; font-size: .9rem; color: var(--muted); }
#page-profile .card > div[style*="display:grid"] { background: transparent !important; gap: 8px !important; overflow: visible !important; }
#page-profile .card > div[style*="display:grid"] > div { border-radius: 13px; background: var(--surface-2) !important; padding: 12px 14px !important; }

/* --- Empty states --- */
.empty { padding: 54px 26px; }
.empty__art { width: 74px; height: 74px; border-radius: 24px; background: linear-gradient(145deg, var(--primary-soft), color-mix(in srgb, var(--accent-soft) 44%, var(--primary-soft))); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.empty__art svg { width: 32px; height: 32px; }
.empty h2 { font-size: 1.22rem; font-weight: 740; letter-spacing: -.03em; }
.empty p { line-height: 1.65; }
.soon { color: var(--faint); }

/* --- Storage / cloud --- */
.storage-note { border: 0; border-radius: 15px; background: var(--primary-soft); color: var(--muted); }
.cloud-row { padding: 2px 0; }
.cloud-status .dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--faint) 13%, transparent); }
.cloud-status.on .dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 13%, transparent); }

/* --- Toast --- */
.toast { background: #20332D; color: #fff; padding: 12px 18px; box-shadow: 0 18px 42px rgba(24,44,36,.25); }
:root[data-theme="dark"] .toast { background: #EFF5F1; color: #1B2D26; }

/* --- Mobile navigation --- */
.bottomnav {
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding: 6px 6px env(safe-area-inset-bottom);
  border-top-color: color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 -10px 34px rgba(43, 62, 55, .06);
}
.bnav { gap: 4px; border-radius: 15px; font-size: 9.5px; font-weight: 670; }
.bnav svg { width: 21px; height: 21px; }
.bnav.is-active { color: var(--primary-ink); background: var(--primary-soft); }

/* --- Auth screen --- */
.authscreen {
  background:
    radial-gradient(circle at 20% 10%, var(--primary-soft), transparent 24rem),
    radial-gradient(circle at 85% 90%, var(--accent-soft), transparent 22rem),
    var(--bg);
}
.authcard { max-width: 410px; }
.authcard.card { padding: 28px; box-shadow: var(--shadow-soft); }
.authcard .brand__mark { background: var(--primary); }
.authcard .brand__name { color: var(--ink); }
.authcard .brand__sub { color: var(--faint); }

/* --- Responsive refinements --- */
@media (max-width: 859px) {
  .page { padding-top: 26px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .petswitch { max-width: 180px; }
}
@media (max-width: 620px) {
  .page { padding-left: 14px; padding-right: 14px; }
  .overview-head { margin-bottom: 20px; }
  .card--pad { padding: 18px; }
  .petcard { min-height: 176px; padding: 17px; }
  .petcard__avatar { width: 66px; height: 66px; border-radius: 20px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  #page-profile .avatar-pick { margin: -18px -18px 20px !important; padding: 26px 20px 22px; }
  #page-profile .avatar-pick__img { width: 96px; height: 96px; border-radius: 28px; }
}
@media (max-width: 420px) {
  .petswitch { max-width: 145px; padding-right: 10px; }
  .petnav { display: none !important; }
  .overview-head .count { font-size: .72rem; }
  .petcard__stats { flex-direction: row; }
  .petcard { min-height: auto; }
}


/* --- Mobile calendar fit fix ---
   Keep all seven day columns inside narrow screens without affecting desktop. */
@media (max-width: 620px) {
  .calgrid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }

  .cal-cell {
    min-width: 0;
    min-height: 0;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 7px 0 0;
    border-radius: 11px;
  }

  .cal-dots { gap: 2px; }
}

@media (max-width: 360px) {
  .calgrid { gap: 3px; }
  .cal-cell { padding-top: 6px; border-radius: 9px; }
  .cal-cell .d { font-size: .78rem; }
  .cal-dots i { width: 4px; height: 4px; }
}

/* ==========================================================================
   iOS PWA fixes — safe areas, bottom nav position, date/time field overflow
   ========================================================================== */

/* 1) Λευκή λωρίδα στο πάνω μέρος (standalone): γέμισε το status-bar inset
   επεκτείνοντας το ίδιο το topbar μέσα του. Σε desktop το env() είναι 0. */
.topbar {
  padding-top: env(safe-area-inset-top);
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
}

/* 2) Κάτω navigation: ρίξε τα εικονίδια χαμηλότερα και κόψε το περιττό κενό.
   Ύψος από το περιεχόμενο + μικρό clearance για το home indicator. */
.bottomnav {
  height: auto;
  padding: 8px 6px max(10px, env(safe-area-inset-bottom));
}

/* 3) Πεδία ημερομηνίας/ώρας που «φεύγουν» εκτός οθόνης:
   επίτρεψε στα grid columns και στα inputs να συρρικνώνονται. */
.form-grid,
.field-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid > .field,
.field-row > .field { min-width: 0; }
.field input,
.field select,
.field textarea { width: 100%; min-width: 0; max-width: 100%; }
input[type="date"],
input[type="time"] { -webkit-appearance: none; appearance: none; }

/* ==========================================================================
   Fixes v2 — Safari top/bottom fill + επαναφορά αρχικού bottom nav
   ========================================================================== */

/* Λευκές λωρίδες σε Safari: το iOS χρωματίζει τις μπάρες από ΣΥΜΠΑΓΕΣ χρώμα
   σελίδας — gradient στο body το ρίχνει σε άσπρο. Κρατάμε το gradient σε
   fixed layer πίσω, και το page background μένει συμπαγές var(--bg). */
html { background-color: var(--bg); }
body { background: transparent; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 76% 8%, color-mix(in srgb, var(--accent-soft) 75%, transparent) 0, transparent 22rem),
    radial-gradient(circle at 25% 95%, color-mix(in srgb, var(--primary-soft) 65%, transparent) 0, transparent 25rem);
}

/* Bottom nav όπως ΠΡΙΝ το redesign: συμπαγές, χωρίς pill/blur, μεγαλύτερα εικονίδια. */
.bottomnav {
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding: 0 0 env(safe-area-inset-bottom);
  background: var(--surface);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  border-top: 1px solid var(--line);
}
.bnav { gap: 3px; border-radius: 0; font-size: 10.5px; font-weight: 600; }
.bnav svg { width: 22px; height: 22px; }
.bnav.is-active { background: transparent; color: var(--primary-ink); }
.bnav.is-active svg { transform: translateY(-1px); }

/* ==========================================================================
   Fixes v3 — standalone PWA: input zoom & top status-bar fill
   ========================================================================== */

/* iOS κάνει auto-zoom όταν εστιάζεις input < 16px, και μετά το login το zoom
   «κολλάει» → οριζόντιο λαστίχωμα. 16px το αποτρέπει τελείως. */
.field input, .field select, .field textarea,
.authcard input { font-size: 16px; }

/* Top status-bar area: συμπαγές topbar (χωρίς blur) ώστε το inset να γεμίζει
   με το χρώμα του φόντου αντί για λευκό. */
.topbar {
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ==========================================================================
   Fixes v4 — "χρειάζονται προσοχή": κουμπί ✓ + checkbox "πραγματοποιήθηκε"
   ========================================================================== */
.attn-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.attn-row:last-child { border-bottom: none; }
.attn { flex: 1; border-bottom: none; }
.attn-done {
  flex: none; width: 52px; display: grid; place-items: center;
  border: none; border-left: 1px solid var(--line); background: none;
  color: var(--ok); transition: background .15s var(--ease);
}
.attn-done:hover { background: color-mix(in srgb, var(--ok) 14%, transparent); }
.attn-done svg { width: 20px; height: 20px; }

.chk {
  display: flex; align-items: center; gap: 9px; margin: 12px 2px 2px;
  font-size: .9rem; color: var(--muted); cursor: pointer;
}
.chk input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }

/* ==========================================================================
   Fixes v5 — σύνοψη υγείας στην κάρτα κατοικιδίου (αρχική)
   ========================================================================== */
.petcard__health {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  position: relative; z-index: 1;
}
.petcard__health .chip { font-size: .72rem; padding: 4px 9px; }

/* ==========================================================================
   Fixes v6 — εικονίδιο δίπλα στον τίτλο κάθε κατηγορίας Υγείας
   ========================================================================== */
.hsec__head h3 { display: flex; align-items: center; gap: 10px; }
.hsec__ic { flex: none; display: inline-flex; color: var(--primary-ink); }
.hsec__ic svg { width: 25px; height: 25px; }

/* ==========================================================================
   Fixes v7 — attention: πράσινο για επερχόμενα (κόκκινο μόνο ληγμένα)·
              επιλεγμένη κάρτα με glow αντί για dot
   ========================================================================== */
.attn__dot { background: var(--primary); }         /* soon → πράσινο */
.attn__dot.overdue { background: var(--danger); }  /* ληγμένο → κόκκινο */

.petcard.is-selected {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 55%, transparent),
              0 8px 26px color-mix(in srgb, var(--primary) 24%, transparent);
}

/* ==========================================================================
   Fixes v8 — collapsible κατηγορίες Υγείας (3 πρόσφατες + «Εμφάνιση όλων»)
   ========================================================================== */
.reclist.is-collapsed .rec:nth-child(n+4) { display: none; }
.hsec__more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 10px; padding: 9px; border: none; background: none;
  color: var(--primary-ink); font-weight: 600; font-size: .85rem; cursor: pointer;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.hsec__more:hover { color: var(--primary); }
.hsec__more svg { width: 15px; height: 15px; transform: rotate(90deg); transition: transform .2s var(--ease); }
.hsec__more.open svg { transform: rotate(-90deg); }

/* ==========================================================================
   Fixes v9 — σελιδοποίηση Εξόδων (10 ανά σελίδα)
   ========================================================================== */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pg {
  min-width: 36px; height: 36px; padding: 0 9px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  font-weight: 600; font-size: .85rem; display: grid; place-items: center;
  cursor: pointer; transition: .15s var(--ease);
}
.pg:hover:not(:disabled):not(.pg--dots) { background: var(--surface-2); color: var(--ink); }
.pg.is-active { background: var(--primary); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .pg.is-active { color: #10130c; }
.pg:disabled { opacity: .4; cursor: default; }
.pg--dots { border: none; background: none; cursor: default; color: var(--faint); }
.pg--nav svg { width: 16px; height: 16px; }
.pg--prev svg { transform: rotate(180deg); }
