:root {
  --ink: #19342a;
  --muted: #687a70;
  --green: #2d6a4f;
  --green-dark: #1d4f3a;
  --green-pale: #def2e5;
  --canvas: #f7faf7;
  --card: #ffffff;
  --line: #dfebe3;
  --amber: #c97a16;
  --rose: #a84141;
  --shadow: 0 10px 30px rgba(24, 64, 44, .08);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #91c9aa; outline-offset: 2px; }

.app-shell { max-width: 760px; min-height: 100vh; margin: auto; padding: 0 18px calc(86px + env(safe-area-inset-bottom)); }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 1.22rem; letter-spacing: -.04em; text-decoration: none; }
.brand strong { color: var(--green); }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 12px; background: var(--green); color: #e9fff0; font-weight: 800; }
.icon-button, .round-action { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--card); color: var(--green); box-shadow: 0 3px 12px rgba(20, 63, 41, .1); font-size: 1.25rem; }
.round-action { background: var(--green); color: white; }

main { padding-bottom: 20px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 12px 0 24px; }
.page-header h1 { margin: 2px 0 0; font-size: clamp(1.65rem, 6vw, 2.3rem); line-height: 1.05; letter-spacing: -.055em; }
.page-header p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--green); font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 29px 0 12px; }
.section-title h2 { margin: 0; font-size: 1.06rem; letter-spacing: -.025em; }
.text-button { border: 0; padding: 4px 0; background: transparent; color: var(--green); font-weight: 750; }

.welcome { overflow: hidden; position: relative; min-height: 190px; padding: 25px; border-radius: 25px; color: white; background: linear-gradient(125deg, #296447, #3c8b66); box-shadow: var(--shadow); }
.welcome:after { content: "🐾"; position: absolute; right: -7px; bottom: -46px; color: rgba(255,255,255,.11); font-size: 11rem; transform: rotate(-18deg); }
.welcome > * { position: relative; z-index: 1; }
.welcome h2 { max-width: 360px; margin: 5px 0 9px; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.1; letter-spacing: -.05em; }
.welcome p { max-width: 360px; margin: 0; color: #e4f7ea; }
.welcome .primary-button { margin-top: 20px; color: var(--green-dark); background: white; }

.pet-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: none; }
.pet-strip::-webkit-scrollbar { display: none; }
.pet-pill { min-width: 112px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 8px 11px; border-radius: 16px; background: var(--card); color: var(--ink); text-align: left; }
.pet-pill.active { border-color: var(--green); background: var(--green-pale); }
.avatar { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #eaf5ed; font-size: 1.2rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pet-pill strong { display: block; max-width: 76px; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.pet-pill small { display: block; color: var(--muted); font-size: .7rem; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.summary-card { min-height: 104px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 4px 12px rgba(20, 63, 41, .035); }
.summary-card span { display: block; color: var(--muted); font-size: .75rem; font-weight: 650; }
.summary-card strong { display: block; margin-top: 7px; color: var(--green-dark); font-size: 1.45rem; letter-spacing: -.05em; }
.summary-card small { color: var(--muted); font-size: .72rem; }

.list-card, .pet-card, .empty-card, .privacy-card { border: 1px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: 0 4px 14px rgba(20, 63, 41, .035); }
.list-card { overflow: hidden; }
.list-item { display: flex; align-items: flex-start; gap: 12px; padding: 15px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.item-icon { width: 38px; height: 38px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 13px; background: #eff8f1; color: var(--green); font-size: 1.1rem; }
.item-body { min-width: 0; flex: 1; }
.item-body strong { display: block; line-height: 1.2; }
.item-body p { margin: 3px 0 0; color: var(--muted); font-size: .85rem; }
.item-date { padding-top: 2px; color: var(--amber); font-size: .72rem; font-weight: 800; text-align: right; white-space: nowrap; }
.badge { display: inline-block; margin-bottom: 5px; padding: 3px 7px; border-radius: 99px; background: #edf7ef; color: var(--green-dark); font-size: .68rem; font-weight: 800; }
.badge.overdue { background: #fff0ee; color: var(--rose); }
.action-row { display: flex; flex-wrap: wrap; gap: 9px; }
.primary-button, .secondary-button { border: 0; border-radius: 13px; padding: 12px 16px; font-weight: 800; text-decoration: none; }
.primary-button { color: white; background: var(--green); box-shadow: 0 5px 12px rgba(41, 105, 76, .2); }
.secondary-button { color: var(--green-dark); background: var(--green-pale); }
.danger-button { border: 0; padding: 8px; background: transparent; color: #a74f4f; font-size: .78rem; font-weight: 750; }

.pet-grid { display: grid; gap: 13px; }
.pet-card { display: flex; align-items: center; gap: 15px; padding: 16px; }
.pet-card .avatar { width: 60px; height: 60px; font-size: 1.75rem; }
.pet-card h2 { margin: 0; font-size: 1.15rem; letter-spacing: -.025em; }
.pet-card p { margin: 3px 0 0; color: var(--muted); font-size: .86rem; }
.pet-card .card-actions { margin-left: auto; display: grid; gap: 5px; justify-items: end; }
.pet-card button { border: 0; padding: 5px 0; background: transparent; color: var(--green); font-weight: 750; }
.empty-card { padding: 28px 22px; text-align: center; }
.empty-card .empty-icon { display: grid; width: 56px; height: 56px; margin: 0 auto 12px; place-items: center; border-radius: 18px; background: var(--green-pale); font-size: 1.55rem; }
.empty-card h2 { margin: 0; font-size: 1.15rem; }
.empty-card p { max-width: 390px; margin: 8px auto 18px; color: var(--muted); }
.privacy-card { padding: 17px; color: #3d5e4c; background: #eff8f1; font-size: .85rem; }
.privacy-card strong { color: var(--green-dark); }
.filter-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 5px; }
.filter-chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; padding: 7px 11px; background: white; color: var(--muted); font-size: .8rem; font-weight: 750; }
.filter-chip.active { border-color: var(--green); color: white; background: var(--green); }

.bottom-nav { position: fixed; z-index: 5; right: 0; bottom: 0; left: 0; display: flex; justify-content: center; gap: min(3vw, 22px); padding: 9px max(18px, env(safe-area-inset-left)) calc(9px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
.nav-item { display: grid; gap: 2px; min-width: 58px; border: 0; padding: 2px 4px; color: #7a8e81; background: transparent; font-size: .7rem; font-weight: 720; }
.nav-item span { font-size: 1.35rem; line-height: 1; }
.nav-item.active { color: var(--green); }

.sheet { width: min(100%, 560px); max-height: min(92vh, 760px); margin: auto 0 0 auto; border: 0; border-radius: 25px 25px 0 0; padding: 0; color: var(--ink); background: white; box-shadow: 0 -10px 50px rgba(18, 51, 35, .22); }
.sheet::backdrop { background: rgba(12, 37, 25, .45); }
.sheet form { display: grid; gap: 14px; padding: 22px 20px calc(25px + env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.sheet-heading h2 { margin: 2px 0 0; font-size: 1.35rem; letter-spacing: -.04em; }
.close-button { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 50%; background: #f0f4f1; color: var(--ink); font-size: 1.5rem; }
.sheet label { display: grid; gap: 5px; color: #3d5347; font-size: .84rem; font-weight: 750; }
.sheet input, .sheet select, .sheet textarea { width: 100%; border: 1px solid #cbdcd1; border-radius: 11px; padding: 11px 12px; color: var(--ink); background: white; }
.sheet textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-field { display: flex; align-items: center; gap: 13px; padding: 8px 0; }
.photo-field img, .photo-field > span { width: 54px; height: 54px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: #eaf5ed; object-fit: cover; font-size: 1.65rem; }
.upload-label { display: inline-flex !important; width: fit-content; color: var(--green) !important; font-size: .84rem !important; text-decoration: underline; cursor: pointer; }
.upload-label input { position: absolute; width: 1px !important; height: 1px; opacity: 0; pointer-events: none; }
.toast { position: fixed; z-index: 10; right: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100vw - 36px); transform: translate(50%, 20px); border-radius: 12px; padding: 11px 15px; color: white; background: #264d39; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s ease; font-size: .86rem; font-weight: 700; }
.toast.visible { transform: translate(50%, 0); opacity: 1; }

@media (min-width: 761px) { .sheet { margin: 5vh auto; border-radius: 25px; } .bottom-nav { width: 520px; right: auto; left: 50%; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; transform: translateX(-50%); } }
@media (max-width: 380px) { .app-shell { padding-inline: 14px; } .summary-grid { gap: 7px; } .summary-card { padding: 11px; } .summary-card strong { font-size: 1.25rem; } .form-grid { grid-template-columns: 1fr; } }
