:root {
    color-scheme: light;
    --ink: #20332d;
    --muted: #62736c;
    --paper: #f2f5f1;
    --surface: #ffffff;
    --line: #d7dfd8;
    --green: #245b4c;
    --green-dark: #174537;
    --mint: #dbece3;
    --coral: #c76047;
    --coral-pale: #f7e8e2;
    --gold: #d4a13e;
    --gold-pale: #f7efda;
    --red: #a63c36;
    --shadow: 0 10px 26px rgba(32, 51, 45, .055);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.55 "Trebuchet MS", "Segoe UI", sans-serif; }
a { color: var(--green-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }

.topbar { min-height: 72px; padding: 0 max(24px, calc((100% - 1220px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--green-dark); color: #fff; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: #fff; font: 20px Georgia, serif; text-decoration: none; }
.brand-mark { display: grid; width: 36px; aspect-ratio: 1; place-items: center; border: 1px solid rgba(255,255,255,.45); color: #f3bd74; font: bold 12px "Trebuchet MS", sans-serif; }
.user-menu { display: flex; align-items: center; gap: 22px; text-align: right; }
.user-menu small { display: block; color: #cbd9d0; font-size: 12px; }
.quiet-button { border: 0; padding: 8px 0; background: transparent; color: #fff; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.shell { width: min(1220px, calc(100% - 48px)); min-height: calc(100vh - 122px); margin: 0 auto; padding: 36px 0 56px; animation: appear .34s ease-out both; }
.footer { min-height: 50px; padding: 12px 24px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.footer span { color: var(--green); }

h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { margin-bottom: 8px; font-size: 34px; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 22px; line-height: 1.25; }
h3 { margin-bottom: 3px; font-size: 17px; }
.page-heading { position: relative; margin-bottom: 28px; padding: 3px 0 21px; border-bottom: 1px solid var(--line); }
.page-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--coral); font-size: 11px; font-weight: bold; letter-spacing: 0; text-transform: uppercase; }
.subtle, small { color: var(--muted); }
.subtle { font-size: 14px; }

.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 18px; }
.admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.client-grid { grid-template-columns: minmax(250px, .72fr) minmax(0, 1.28fr); }
.panel, .auth-panel { min-width: 0; padding: 23px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
.panel { margin-bottom: 2px; }
.narrow { max-width: 560px; margin-right: auto; margin-left: auto; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.count { display: inline-grid; min-width: 28px; height: 28px; padding: 0 7px; place-items: center; border-radius: 50%; background: var(--mint); color: var(--green-dark); font-size: 13px; font-weight: bold; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.stat { min-height: 88px; padding: 14px 17px; display: flex; flex-direction: column; justify-content: space-between; border-left: 3px solid var(--gold); background: #fff; }
.stat:nth-child(2) { border-color: var(--green); }
.stat:nth-child(3) { border-color: var(--coral); }
.stat:nth-child(4) { border-color: #70978a; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { font: 28px/1 Georgia, serif; }

.form-stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--ink); font-size: 14px; font-weight: bold; }
input, textarea, select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #bac9be; border-radius: 3px; background: #fff; color: var(--ink); }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(212,161,62,.48); outline-offset: 2px; }
input[type="file"] { padding: 8px; font-size: 13px; }
.button { min-height: 40px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 3px; font-size: 14px; font-weight: bold; cursor: pointer; transition: background-color .16s ease, border-color .16s ease, transform .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover { background: var(--green-dark); }
.button.muted { border-color: #c5d2c9; background: #f2f6f3; color: var(--green-dark); }
.button.muted:hover { background: var(--mint); }
.button.small { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.button-pair { display: flex; flex-wrap: wrap; gap: 6px; }
.inline-form { display: inline; }
.notice { margin: 0 0 22px; padding: 12px 15px; border-left: 4px solid var(--green); background: var(--mint); color: var(--green-dark); }
.notice.error { border-color: var(--red); background: #f9e9e7; color: #762d28; }
.empty-state { margin: 0; padding: 16px 0; color: var(--muted); font-size: 14px; }
.list-row, .client-row { min-height: 54px; padding: 11px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #e8ede9; }
.list-row:first-of-type, .client-row:first-of-type { border-top: 0; }
.list-row > span, .list-row > div, .client-row > span { min-width: 0; }
.list-row strong, .list-row small, .client-row strong, .client-row small { display: block; }
.list-row small, .client-row small { margin-top: 3px; font-size: 12px; }
.client-row { color: var(--ink); text-decoration: none; }
.client-row:hover strong { color: var(--coral); }
.status-tag { display: inline-block; max-width: 140px; padding: 4px 8px; border-radius: 2px; background: var(--gold-pale); color: #765719; font-size: 11px; white-space: nowrap; }
.status-tag.approved { background: var(--mint); color: var(--green-dark); }
.status-tag.rejected { background: var(--coral-pale); color: #8e3f31; }
.arrow { color: var(--coral); font-size: 13px; }
.activity-row { min-height: 54px; padding: 10px 0; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-top: 1px solid #e8ede9; }
.activity-dot { width: 8px; aspect-ratio: 1; border-radius: 50%; background: var(--coral); }
.activity-row strong, .activity-row small { display: block; }
.activity-row strong { font-size: 13px; text-transform: capitalize; }
.activity-row small, .activity-row time, .list-row time { font-size: 11px; }
.activity-row time, .list-row time { color: var(--muted); white-space: nowrap; }
.simple-list a { padding: 10px 0; display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid #e8ede9; text-decoration: none; }
.invite-callout { margin-top: 18px; padding: 14px; border-left: 3px solid var(--gold); background: var(--gold-pale); }
.invite-callout strong, .invite-callout small { display: block; }
.invite-callout input { margin: 9px 0 5px; font-size: 12px; }
.invite-callout small { font-size: 12px; }
.privacy-panel { margin-top: 18px; }
.privacy-panel hr { margin: 22px 0; border: 0; border-top: 1px solid var(--line); }
.confirmation { display: flex; grid-template-columns: auto 1fr; align-items: start; gap: 9px; font-weight: normal; }
.confirmation input { margin-top: 5px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 14px; }
.filter-actions { display: flex; gap: 8px; }
.visit-results { margin-top: 18px; }
.table-scroll { overflow-x: auto; }
.visit-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.visit-table th, .visit-table td { padding: 10px 12px; border-bottom: 1px solid #e8ede9; }
.visit-table th { color: var(--muted); font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; }

.auth-panel { margin-top: 5vh; padding: clamp(22px, 5vw, 42px); border-top: 4px solid var(--coral); }
.auth-panel h1 { margin-bottom: 10px; }
.auth-panel > p:not(.eyebrow) { color: var(--muted); }
.auth-panel .subtle { margin: 18px 0 0; }
.animal-list { display: grid; gap: 5px; }
.animal-row { padding: 14px 0; display: grid; grid-template-columns: 68px minmax(0, 1fr); align-items: start; gap: 14px; border-top: 1px solid #e8ede9; }
.animal-photo, .animal-placeholder { width: 68px; height: 68px; object-fit: cover; border-radius: 3px; }
.animal-placeholder { display: grid; place-items: center; background: var(--coral-pale); color: var(--coral); font-size: 24px; }
.animal-row p { margin: 2px 0; color: var(--muted); font-size: 13px; }
.animal-edit { padding: 12px 0; border-top: 1px solid #e8ede9; }
.animal-edit summary { color: var(--green-dark); font-weight: bold; cursor: pointer; }
.animal-edit summary span { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: normal; }
.animal-edit-photo { width: 48px; height: 48px; margin-right: 8px; object-fit: cover; vertical-align: middle; border-radius: 3px; }
.animal-edit .form-stack { margin-top: 12px; }
.note-entry { padding: 13px 0; border-top: 1px solid #e8ede9; }
.note-entry p { margin-bottom: 5px; white-space: normal; }
.note-entry small { font-size: 11px; }
.message-panel { margin-bottom: 18px; }
.message-list { max-height: 360px; overflow: auto; }
.message { margin: 0 0 11px; padding: 12px 14px; border-left: 3px solid var(--mint); background: #f5f8f5; }
.message strong { font-size: 13px; }
.message p { margin: 5px 0; overflow-wrap: anywhere; }
.message small { font-size: 11px; }
.message-form { margin-top: 14px; }
.visit-qr { width: min(260px, 100%); height: auto; display: block; margin: 8px auto 14px; image-rendering: pixelated; }

@keyframes appear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 800px) {
    .shell { width: min(100% - 32px, 640px); padding-top: 26px; }
    .content-grid, .client-grid, .admin-grid { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar { min-height: 64px; padding: 0 16px; }
}
@media (max-width: 500px) {
    .topbar { align-items: flex-start; padding-top: 12px; padding-bottom: 11px; }
    .brand { padding-top: 4px; font-size: 17px; }
    .user-menu { gap: 10px; font-size: 13px; }
    .quiet-button { font-size: 12px; }
    .shell { width: calc(100% - 24px); padding-top: 22px; }
    .page-heading { margin-bottom: 20px; }
    h1 { font-size: 29px; }
    h2 { font-size: 20px; }
    .panel { padding: 17px; }
    .stat { min-height: 78px; padding: 12px; }
    .stat span { font-size: 12px; }
    .stat strong { font-size: 24px; }
    .list-row { align-items: flex-start; flex-direction: column; }
    .filter-grid { grid-template-columns: 1fr; }
    .activity-row { grid-template-columns: 9px minmax(0, 1fr); }
    .activity-row time { grid-column: 2; }
    .footer { padding-right: 12px; padding-left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}