:root {
  color-scheme: light;
  font: 100%/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  --ink: #1c302b;
  --muted: #52645d;
  --paper: #f4f3ee;
  --surface: #fffefa;
  --line: #dfe5dc;
  --green: #175b43;
  --green-soft: #e4f0e6;
  --danger: #9f3438;
  --input: #fff;
  --control-border: #bdcec0;
  --subtle: #f4f7f0;
  --segments: #edf0e8;
  --hover: #edf2e9;
  --focus: #357b64;
  --primary: #175b43;
  --primary-hover: #114a36;
  --primary-ink: #fff;
  --chart-line: #207251;
  --chart-fill-top: #c5e9d5;
  --chart-fill-bottom: #edf7ef;
  --scrim: #182f29aa;
  --radius: 1.25rem;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e5efe9;
  --muted: #b2c4b9;
  --paper: #101915;
  --surface: #182520;
  --line: #34483e;
  --green: #8fd9af;
  --green-soft: #253e32;
  --danger: #ff9fa6;
  --input: #111e18;
  --control-border: #667f72;
  --subtle: #20312a;
  --segments: #111d17;
  --hover: #293c33;
  --focus: #8bd5ab;
  --primary: #8fd9af;
  --primary-hover: #aedfc6;
  --primary-ink: #102d20;
  --chart-line: #8fe0b1;
  --chart-fill-top: #305743;
  --chart-fill-bottom: #21372c;
  --scrim: #060d0bbf;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.05; letter-spacing: -.055em; font-weight: 740; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; line-height: 1.2; letter-spacing: -.025em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip { position: absolute; z-index: 2; top: .5rem; left: .5rem; padding: .5rem 1rem; background: var(--surface); transform: translateY(-150%); }
.skip:focus { transform: translateY(0); }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner, .shell { width: min(100% - 2.5rem, 73rem); margin: auto; }
.top-inner { min-height: 4.35rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { text-decoration: none; font-size: 1.25rem; font-weight: 800; letter-spacing: -.055em; display: flex; align-items: center; gap: .7rem; }
.brand-light { color: var(--green); font-weight: 550; }
.brand-mark { display: inline-grid; place-items: center; border-radius: 33%; background: var(--primary); color: var(--primary-ink); width: 2.1rem; height: 2.1rem; flex: none; position: relative; }
.brand-mark i { position: absolute; left: 33%; top: 49%; width: 34%; height: 27%; background: currentColor; border-radius: 65% 65% 45% 45%; }
.brand-mark i::before { content: ""; position: absolute; width: 37%; height: 56%; background: currentColor; border-radius: 50%; top: -62%; left: -21%; transform: rotate(-20deg); box-shadow: .3em -.15em 0 currentColor; }
.brand-mark i::after { content: ""; position: absolute; width: 37%; height: 56%; background: currentColor; border-radius: 50%; top: -62%; right: -21%; transform: rotate(20deg); box-shadow: -.3em -.15em 0 currentColor; }
.shell { padding: 2.6rem 0 4rem; }
.loading { color: var(--muted); }
.muted { color: var(--muted); }
.setup-heading { margin-bottom: 1.25rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 5px #263e2d07; min-width: 0; }
.household-heading, .section-head, .pet-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.household-heading { margin-bottom: 1.7rem; }
.dashboard { display: grid; grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr); align-items: start; gap: 1.1rem; }
.sidebar { display: grid; gap: 1rem; min-width: 0; }
.pets-panel { padding: 1.15rem; }
.pet-list, .record-list { list-style: none; padding: 0; margin: 0; }
.pet-list { display: grid; gap: .4rem; margin: .9rem 0; }
.pets-panel h2 + .add-pet { margin-top: .9rem; }
.button { min-height: 2.5rem; padding: .48rem .9rem; border: 1px solid transparent; border-radius: .7rem; background: transparent; color: var(--ink); font-size: .875rem; font-weight: 680; line-height: 1.25; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-align: center; }
.button:disabled { opacity: .65; cursor: wait; }
.button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.button.primary:hover { background: var(--primary-hover); }
.button.secondary { background: var(--surface); border-color: var(--control-border); color: var(--green); }
.button.secondary:hover, .button.quiet:hover, .button.pet-option:hover { background: var(--hover); }
.button.quiet { color: var(--green); }
.button.danger { background: #9f3438; color: white; }
.button.danger-text { color: var(--danger); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.add-pet { width: 100%; }
.button.pet-option { display: flex; padding: .4rem; width: 100%; justify-content: flex-start; text-align: left; }
.button.pet-option[aria-current="true"] { color: var(--green); background: var(--green-soft); border-color: var(--line); }
.pet-label, .pet-identity { display: flex; align-items: center; min-width: 0; gap: .65rem; }
.pet-name, .pet-title { overflow-wrap: anywhere; }
.pet-heading { padding: .2rem .1rem; }
.pet-heading p { margin-top: .2rem; font-size: .9rem; }
.pet-title { font-size: clamp(1.55rem, 4vw, 2rem); }
.avatar { width: 2rem; height: 2rem; flex: none; display: inline-grid; place-items: center; border-radius: .6rem; color: #493e22; background: #f2e4af; font-weight: 760; }
.avatar.large { width: 3.25rem; height: 3.25rem; font-size: 1.45rem; border-radius: .9rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.large.has-photo { width: 4.5rem; height: 4.5rem; }
.tone-1 { background: #e7e1f7; color: #473479; }
.tone-2 { background: #f7e1d7; color: #6d3c29; }
.tone-3 { background: #d5ebe6; color: #20554a; }
[data-theme="dark"] .tone-0 { background: #4d3e23; color: #ffe0a6; }
[data-theme="dark"] .tone-1 { background: #3e3555; color: #e1d5ff; }
[data-theme="dark"] .tone-2 { background: #51352c; color: #ffcbbc; }
[data-theme="dark"] .tone-3 { background: #244742; color: #b4e9db; }
.pet-detail { display: grid; gap: 1rem; min-width: 0; }
.profile-notes, .record-note, .document-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.pet-records { display: grid; gap: 1rem; padding: 1.25rem; }
.pet-records > section { border-top: 1px solid var(--line); padding-top: 1rem; }
.pet-records-heading > h2, .chart-panel > .section-head > h2 { font-size: clamp(1.25rem, 2vw, 1.45rem); }
.chart-panel .section-head, .history .section-head { margin-bottom: 1.05rem; }
.segments { display: flex; align-items: center; padding: .2rem; gap: .1rem; background: var(--segments); border-radius: .75rem; flex-wrap: wrap; }
.button.segment { min-height: 2rem; color: var(--muted); padding: .3rem .57rem; }
.button.segment:hover { color: var(--green); }
.button.segment[aria-pressed="true"] { background: var(--surface); border-color: var(--line); color: var(--green); box-shadow: 0 1px 2px #273b2610; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.metric { display: grid; justify-items: start; align-content: start; background: var(--subtle); padding: .75rem .9rem; border-radius: .85rem; }
.metric > span { font-size: .875rem; }
.metric > strong { font-size: clamp(1.15rem, 3vw, 1.65rem); color: var(--green); letter-spacing: -.04em; }
.axis-unit { margin: 1.2rem 0 .3rem; font-size: .875rem; }
.chart { width: 100%; height: clamp(10rem, 29vw, 16rem); display: block; }
.chart-note { font-size: .875rem; min-height: 1.5em; margin-top: .2rem; }
.empty { padding: .55rem 0; }
.history-action { display: flex; align-items: flex-end; justify-content: flex-end; flex-wrap: wrap; gap: .6rem; margin-bottom: .65rem; }
.document-actions { justify-content: space-between; }
.document-search { display: flex; align-items: flex-end; gap: .5rem; flex: 1 1 16rem; max-width: 30rem; min-width: 0; }
.document-search .field { flex: 1; min-width: 0; }
.care-filter { margin-right: auto; }
.record { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.record-text { min-width: 0; overflow-wrap: anywhere; }
.record .muted { font-size: .875rem; }
.record-actions { justify-content: flex-end; flex: none; }
.record-actions .button { padding-inline: .45rem; }
.record-note { margin-top: .25rem; }
.reminders-panel { padding: 1.15rem; }
.reminders-panel h2 { margin-bottom: .55rem; }
.reminders-panel summary { margin-top: .45rem; color: var(--green); cursor: pointer; font-size: .875rem; }
.button.reminder-link { width: 100%; justify-content: flex-start; text-align: left; padding: .45rem; }
.reminder-summary { display: grid; justify-items: start; gap: .25rem; width: 100%; overflow-wrap: anywhere; }
.reminder-summary .muted { font-weight: 500; }
.reminder-title { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.reminder-status { width: fit-content; border-radius: .4rem; padding: .1rem .4rem; background: var(--green-soft); color: var(--green); font-size: .875rem; }
.reminder-status.overdue { background: var(--subtle); color: var(--danger); }
.reminder-status.complete { background: var(--subtle); color: var(--muted); }
.health-tab { display: grid; gap: 1.5rem; }
.health-block + .health-block { padding-top: 1rem; border-top: 1px solid var(--line); }
.health-block h3 { font-size: 1rem; }
.health-block .section-head { margin-bottom: .7rem; }
.health-details { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .65rem; }
.health-details div { min-width: 0; padding: .65rem .8rem; border-radius: .65rem; background: var(--subtle); }
.health-details dt { color: var(--muted); font-weight: 680; font-size: .875rem; }
.health-details dd { margin: .25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.health-block .record-actions { max-width: 55%; }
.pet-footer { display: flex; justify-content: flex-end; }
.welcome { min-height: 22rem; display: grid; grid-template-columns: 1fr 1.15fr; align-items: center; gap: clamp(1rem, 4vw, 3.25rem); padding: clamp(1rem, 5vw, 3.25rem); }
.welcome-art { display: grid; place-items: center; min-height: 14rem; align-self: stretch; border-radius: 1rem; background: radial-gradient(ellipse at 70% 30%, #ecf3cf, #c9e5d3); }
.welcome-art .brand-mark { width: 5.25rem; height: 5.25rem; font-size: 2.5rem; transform: rotate(-9deg); box-shadow: 0 1rem 1.5rem #17442a25; }
.welcome h1 { margin-bottom: 1rem; }
.setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.setup-panel, .editor { padding: 1.4rem; display: grid; gap: .9rem; align-content: start; }
.setup-panel .button { justify-self: start; }
.field { display: grid; gap: .28rem; font-size: .9rem; font-weight: 640; }
.check-field { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.check-field input { width: auto; accent-color: var(--primary); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.scale-controls { display: grid; gap: .55rem; }
.scale-controls .actions > p { font-size: .875rem; }
.scale-controls > .button { justify-self: start; }
.scale-photo { display: block; max-width: 100%; max-height: 46vh; margin-inline: auto; touch-action: none; cursor: crosshair; }
input, select, textarea { width: 100%; min-width: 0; color: var(--ink); background-color: var(--input); border: 1px solid var(--control-border); border-radius: .55rem; padding: .55rem .65rem; font-size: 1rem; }
input[type="file"] { padding: .45rem; }
textarea { resize: vertical; }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
dialog { padding: 0; width: min(calc(100% - 1.5rem), 34rem); max-height: calc(100% - 1.5rem); border-radius: var(--radius); border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
dialog::backdrop { background: var(--scrim); }
.dialog-actions { justify-content: flex-end; margin-top: .3rem; }
.form-error { color: var(--danger); }
.status-text:empty { position: absolute; }
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 3; width: max-content; max-width: calc(100% - 1.5rem); background: var(--ink); color: var(--paper); border-radius: .7rem; padding: .65rem 1rem; box-shadow: 0 .2rem 1rem #0002; }
.document-text { max-height: 18rem; overflow: auto; padding: .75rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--subtle); }
#health-print { display: none; }
@media (max-width: 720px) {
  .top-inner, .shell { width: calc(100% - 1.5rem); }
  .shell { padding-top: 1.6rem; }
  .dashboard, .welcome { grid-template-columns: 1fr; }
  .pet-list { display: flex; flex-wrap: wrap; margin: .65rem 0; }
  .add-pet { width: auto; }
  .welcome-art { min-height: 8rem; }
  .household-heading { margin-bottom: 1rem; }
}
@media (max-width: 490px) {
  .setup-grid { grid-template-columns: 1fr; }
  .pet-heading, .section-head { align-items: flex-start; flex-direction: column; gap: .6rem; }
  .pet-records { padding: .85rem; }
  .household-heading { align-items: flex-start; }
  .household-heading .button { flex: none; }
  .record-actions { max-width: 8.25rem; gap: 0; }
  .top-inner { gap: .2rem; }
  .account-actions { gap: 0; }
  .account-actions .button { padding-inline: .44rem; }
  .brand { gap: .4rem; }
}
@media print {
  body.printing-health { background: white; color: black; font: 11pt/1.4 system-ui, sans-serif; }
  .printing-health > :not(#health-print) { display: none !important; }
  .printing-health > #health-print { display: block; }
  #health-print h1 { font-size: 22pt; letter-spacing: normal; margin: 0 0 5pt; }
  #health-print h2 { font-size: 13pt; margin: 0 0 4pt; break-after: avoid; }
  #health-print section { margin-top: 15pt; }
  #health-print li { margin: 0 0 4pt; break-inside: avoid; overflow-wrap: anywhere; }
  #health-print ul { margin: 0; padding-left: 16pt; }
  #health-print .health-details { margin-top: 10pt; }
  #health-print .health-details div { background: white; border: 1px solid #bbb; break-inside: avoid; }
  #health-print .muted, #health-print dt { color: #333; }
}
