:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f5f2ee;
  --surface-3: #ece8e2;
  --ink: #1a1613;
  --muted: #6b6259;
  --faint: #9a918a;
  --line: rgba(0, 0, 0, .08);
  --accent: #c08b4a;
  --accent-strong: #a87530;
  --accent-soft: rgba(192, 139, 74, .1);
  --green: #5a8a5a;
  --blue: #5078a0;
  --red: #c05040;
  --orange: #c08030;
  --shadow: 0 22px 70px rgba(0, 0, 0, .08);
  --font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; height: 58px; padding: 0 max(22px, env(safe-area-inset-right)) 0 max(22px, env(safe-area-inset-left)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); background: rgba(250, 248, 245, .92); backdrop-filter: blur(16px); }
.brand { justify-self: start; display: inline-flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 0; font-size: 15px; font-weight: 760; letter-spacing: -.2px; }
.brand-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #faf8f5; font-family: Georgia, serif; font-size: 14px; }
.desktop-nav { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--surface); }
.nav-item { position: relative; min-height: 32px; padding: 5px 13px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.nav-item.active { background: var(--surface-3); color: var(--ink); box-shadow: 0 2px 7px rgba(0, 0, 0, .18); }
.nav-count { display: inline-grid; place-items: center; min-width: 16px; height: 16px; margin-left: 3px; padding: 0 4px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-strong); font-size: 9px; }
.live-dot { display: inline-block; width: 6px; height: 6px; margin: 0 0 1px 5px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(210,124,112,.12); }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.icon-button, .avatar-button, .close-button { display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); }
.icon-button { width: 34px; height: 34px; border-radius: 9px; }
.icon-button svg { width: 17px; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.avatar-button { width: 32px; height: 32px; border-radius: 50%; background: #c08b4a; color: #fff; font-size: 12px; font-weight: 750; }

main { width: min(100%, 1120px); margin: 0 auto; padding: 34px max(24px, env(safe-area-inset-right)) 90px max(24px, env(safe-area-inset-left)); }
.page { display: none; animation: pageIn .22s ease both; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 3px; color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 32px; line-height: 1.15; letter-spacing: -1px; }
h2 { margin-bottom: 0; font-size: 17px; letter-spacing: -.3px; }
h3 { margin-bottom: 0; font-size: 15px; }
.primary-button { min-height: 38px; padding: 7px 14px; border: 1px solid rgba(237,191,133,.22); border-radius: 10px; background: var(--accent); color: #ffffff; font-size: 13px; font-weight: 760; box-shadow: 0 5px 18px rgba(213,167,111,.12); }
.primary-button:hover { background: var(--accent-strong); }
.primary-button:active { transform: scale(.98); }
.text-button { padding: 3px; border: 0; background: transparent; color: var(--accent-strong); font-size: 12px; font-weight: 650; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.search-box { width: min(320px, 100%); min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.search-box:focus-within { border-color: rgba(213,167,111,.38); }
.search-box svg { width: 16px; fill: none; stroke: var(--faint); stroke-width: 1.8; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input::placeholder { color: var(--faint); }
.filter-row { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--surface); }
.filter-chip { min-height: 31px; padding: 4px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.filter-chip span { color: var(--faint); font-size: 10px; }
.filter-chip.active { background: var(--surface-3); color: var(--ink); }
.location-summary { display: flex; gap: 7px; margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.location-summary::-webkit-scrollbar { display: none; }
.location-pill { flex: 0 0 auto; min-height: 30px; display: flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: 11px; }
.location-pill.active { border-color: rgba(213,167,111,.24); background: var(--accent-soft); color: var(--ink); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.status-dot.home { background: var(--green); }.status-dot.company { background: var(--blue); }.status-dot.hospital { background: var(--red); }.status-dot.history { background: #8d8277; }

.pet-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 20px 13px; }
.pet-card { min-width: 0; padding: 0; border: 0; background: transparent; text-align: center; }
.pet-photo { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid rgba(0,0,0,.08); border-radius: 16px; background: var(--surface-2); transition: transform .18s ease, border-color .18s ease; }
.pet-card:hover .pet-photo { transform: translateY(-2px); border-color: rgba(213,167,111,.34); }
.pet-card:active .pet-photo { transform: scale(.97); }
.pet-card-name { display: block; margin-top: 7px; overflow: hidden; color: #3a342d; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.pet-card .status-dot { position: absolute; right: 6px; bottom: 6px; width: 7px; height: 7px; border: 2px solid rgba(250,248,245,.85); box-sizing: content-box; }
.pet-avatar { display: grid; place-items: center; background-image: radial-gradient(circle at 28% 22%, rgba(255,255,255,.16), transparent 30%), linear-gradient(145deg, rgba(255,255,255,.04), rgba(0,0,0,.12)); color: rgba(255,255,255,.82); }
.pet-avatar::before { content: ""; position: absolute; width: 42%; height: 42%; top: 23%; border: 2px solid rgba(255,255,255,.28); border-radius: 50% 50% 44% 44%; }
.pet-avatar.cat::after { content: ""; position: absolute; width: 36%; height: 18%; top: 17%; background: linear-gradient(135deg, transparent 47%, rgba(255,255,255,.22) 49% 70%, transparent 72%) left/50% 100% no-repeat, linear-gradient(225deg, transparent 47%, rgba(255,255,255,.22) 49% 70%, transparent 72%) right/50% 100% no-repeat; }
.pet-avatar.dog::after { content: ""; position: absolute; width: 58%; height: 32%; top: 20%; border-left: 5px solid rgba(255,255,255,.2); border-right: 5px solid rgba(255,255,255,.2); border-radius: 38%; }
.pet-avatar span { position: relative; z-index: 2; margin-top: 41%; font-family: Georgia, serif; font-size: clamp(15px, 1.8vw, 22px); font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.tone-0 { background-color: #6e5646; }.tone-1 { background-color: #5c6255; }.tone-2 { background-color: #705b5b; }.tone-3 { background-color: #4f6470; }.tone-4 { background-color: #6c624a; }.tone-5 { background-color: #5e5369; }.tone-6 { background-color: #765f4f; }.tone-7 { background-color: #52645e; }
.empty-state { padding: 70px 20px; color: var(--faint); text-align: center; }
.empty-state p { margin-bottom: 7px; }

.task-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 28px; }
.task-stat { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); }
.task-stat strong { color: var(--ink); font-size: 23px; }.task-stat.urgent { border-color: rgba(210,124,112,.22); background: rgba(210,124,112,.08); }.task-stat.urgent strong { color: #b84030; }
.section-block { margin-top: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-heading span { color: var(--faint); font-size: 11px; }
.task-list, .case-list { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.task-row, .case-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 68px; padding: 11px 14px; border-top: 1px solid var(--line); }
.task-row:first-child, .case-row:first-child { border-top: 0; }
.task-row:hover, .case-row:hover { background: rgba(0,0,0,.02); }
.task-check { width: 22px; height: 22px; border: 1.5px solid var(--faint); border-radius: 50%; background: transparent; }
.task-check:hover { border-color: var(--green); }
.row-avatar { position: relative; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; }
.row-avatar span { margin-top: 38%; font-size: 12px; }
.row-avatar::before { border-width: 1px; }
.row-title { font-size: 13px; font-weight: 700; }
.row-meta { margin: 2px 0 0; color: var(--faint); font-size: 11px; }
.due-label { padding: 4px 8px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 10px; font-weight: 700; }
.due-label.overdue { background: rgba(210,124,112,.12); color: #b84030; }
.completed-row { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.02); color: var(--muted); }
.completed-row strong { color: var(--muted); font-size: 13px; text-decoration: line-through; }.completed-row p { margin: 2px 0 0; color: var(--faint); font-size: 11px; }.check-ring { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: rgba(131,171,131,.13); color: var(--green); font-size: 11px; }

.hospital-banner { position: relative; display: flex; align-items: center; gap: 15px; padding: 17px; overflow: hidden; border: 1px solid rgba(210,124,112,.22); border-radius: 17px; background: linear-gradient(120deg, rgba(210,124,112,.08), rgba(255,255,255,.95)); cursor: pointer; }
.hospital-banner::after { content:""; position:absolute; width:180px; height:180px; right:-70px; top:-100px; border-radius:50%; background:rgba(210,124,112,.07); }
.hospital-avatar { position: relative; width: 54px; height: 54px; flex: 0 0 auto; border-radius: 15px; }.hospital-avatar span { margin-top: 38%; font-size: 17px; }
.hospital-main { min-width: 0; flex: 1; }.hospital-title { display:flex; align-items:center; gap:8px; }.hospital-main p { margin: 3px 0 8px; color: var(--muted); font-size: 12px; }.pulse-dot { width: 7px; height: 7px; border-radius:50%; background:var(--red); box-shadow:0 0 0 0 rgba(210,124,112,.5); animation:pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(210,124,112,0); } 100% { box-shadow:0 0 0 0 rgba(210,124,112,0); } }
.hospital-tags { display:flex; flex-wrap:wrap; gap:6px; }.hospital-tags span { padding:3px 7px; border-radius:99px; background:rgba(0,0,0,.05); color:#c4b9ae; font-size:10px; }.chevron { position:relative; z-index:1; color:var(--faint); font-size:25px; }
.case-row { cursor: pointer; }.case-type { color:var(--accent-strong); font-size:10px; font-weight:750; }.case-date { color:var(--faint); font-size:10px; white-space:nowrap; }

.back-button { display: inline-flex; align-items:center; gap:4px; margin-bottom:20px; padding:4px 0; border:0; background:transparent; color:var(--muted); font-size:12px; }.back-button span { font-size:20px; line-height:1; }
.detail-hero { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:18px; margin-bottom:22px; }.detail-avatar { position:relative; width:92px; height:92px; border-radius:24px; }.detail-avatar span { margin-top:40%; font-size:26px; }.detail-title h1 { font-size:30px; }.detail-title p { margin:4px 0 0; color:var(--muted); font-size:12px; }.status-badge { display:inline-flex; align-items:center; gap:6px; margin-top:9px; padding:4px 8px; border-radius:99px; background:var(--surface-2); color:var(--muted); font-size:10px; font-weight:700; }
.detail-tabs { display:flex; gap:3px; margin-bottom:18px; padding:3px; border-radius:10px; background:var(--surface); }.detail-tab { flex:1; min-height:34px; border:0; border-radius:7px; background:transparent; color:var(--muted); font-size:12px; font-weight:650; }.detail-tab.active { background:var(--surface-3); color:var(--ink); }
.detail-panel { display:none; }.detail-panel.active { display:block; animation:pageIn .18s ease; }
.info-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }.info-card { min-height:78px; padding:13px; border:1px solid var(--line); border-radius:13px; background:var(--surface); }.info-label { color:var(--faint); font-size:10px; }.info-value { margin-top:5px; color:#e5ddd3; font-size:14px; font-weight:700; }.info-card.wide { grid-column:span 2; }.health-alert { margin-top:10px; padding:14px; border:1px solid rgba(213,167,111,.17); border-radius:13px; background:var(--accent-soft); }.health-alert p { margin:4px 0 0; color:#c9b8a6; font-size:12px; }
.timeline { position:relative; display:grid; gap:0; padding-left:15px; }.timeline::before { content:""; position:absolute; left:4px; top:9px; bottom:12px; width:1px; background:var(--line); }.timeline-item { position:relative; padding:0 0 18px 18px; }.timeline-item::before { content:""; position:absolute; left:-14px; top:7px; width:7px; height:7px; border-radius:50%; background:var(--accent); border:3px solid var(--bg); }.timeline-date { color:var(--faint); font-size:10px; }.timeline-title { margin-top:2px; font-size:13px; font-weight:700; }.timeline-note { margin:2px 0 0; color:var(--muted); font-size:11px; }

.floating-add { position:fixed; right:max(24px,env(safe-area-inset-right)); bottom:26px; z-index:18; width:48px; height:48px; border:1px solid rgba(237,191,133,.26); border-radius:15px; background:var(--accent); color:#241b12; font-size:26px; line-height:1; box-shadow:0 12px 34px rgba(0,0,0,.35); }.floating-add:hover { background:var(--accent-strong); transform:translateY(-1px); }
.mobile-nav { display:none; }
.modal-backdrop { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:18px; background:rgba(0,0,0,.35); backdrop-filter:blur(7px); }.modal-sheet { width:min(100%,520px); max-height:min(720px,calc(100dvh - 36px)); overflow:auto; padding:20px; border:1px solid var(--line); border-radius:20px; background:var(--surface); box-shadow:var(--shadow); animation:modalIn .2s ease both; }.sheet-handle { display:none; }.modal-header { display:flex; align-items:flex-start; justify-content:space-between; gap:15px; margin-bottom:18px; }.modal-header h2 { font-size:20px; }.close-button { width:32px; height:32px; border-radius:9px; color:var(--muted); font-size:21px; }.quick-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:9px; }.quick-action { min-height:74px; padding:12px; border:1px solid var(--line); border-radius:13px; background:var(--surface-2); text-align:left; }.quick-action:hover { border-color:rgba(213,167,111,.3); background:var(--surface-3); }.quick-action strong { display:block; font-size:13px; }.quick-action span { display:block; margin-top:3px; color:var(--faint); font-size:10px; }
.form-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }.field { display:grid; gap:5px; }.field.full { grid-column:1/-1; }.field label { color:var(--muted); font-size:11px; font-weight:650; }.field input,.field select,.field textarea { width:100%; min-height:40px; padding:8px 10px; border:1px solid var(--line); border-radius:9px; outline:0; background:#181613; color:var(--ink); font-size:13px; }.field textarea { min-height:86px; resize:vertical; }.form-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }.secondary-button { min-height:38px; padding:7px 13px; border:1px solid var(--line); border-radius:10px; background:transparent; color:var(--muted); font-size:13px; }
@keyframes modalIn { from { opacity:0; transform:scale(.98) translateY(7px); } to { opacity:1; transform:none; } }
.toast { position:fixed; left:50%; bottom:26px; z-index:80; max-width:calc(100% - 32px); padding:9px 13px; border:1px solid var(--line); border-radius:10px; background:#39332c; color:var(--ink); box-shadow:var(--shadow); font-size:12px; opacity:0; pointer-events:none; transform:translate(-50%,10px); transition:.2s ease; }.toast.show { opacity:1; transform:translate(-50%,0); }

@media (max-width: 900px) { .pet-grid { grid-template-columns:repeat(8,minmax(0,1fr)); }.info-grid { grid-template-columns:repeat(2,1fr); } }
@media (max-width: 680px) {
  body { font-size:14px; }
  .topbar { height:calc(52px + env(safe-area-inset-top)); padding-top:env(safe-area-inset-top); grid-template-columns:1fr auto; }
  .desktop-nav { display:none; }.top-actions .icon-button { display:none; }
  main { padding:22px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom:18px; align-items:center; }.page-heading h1 { font-size:27px; }.desktop-add { display:none; }
  .toolbar { display:grid; gap:10px; }.search-box { width:100%; }.filter-row { width:max-content; }
  .location-summary { margin:0 -16px 20px; padding:0 16px; }
  .pet-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:18px 11px; }.pet-photo { border-radius:14px; }.pet-card-name { margin-top:6px; font-size:11px; }
  .pet-avatar span { font-size:18px; }
  .task-overview { gap:7px; }.task-stat { min-height:56px; padding:10px; }.task-stat strong { font-size:20px; }
  .task-row,.case-row { padding:10px 11px; gap:10px; }.due-label { max-width:66px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .hospital-banner { align-items:flex-start; padding:14px; }.hospital-avatar { width:46px;height:46px;border-radius:13px; }.hospital-main p { line-height:1.4; }
  .detail-hero { grid-template-columns:auto 1fr; gap:13px; }.detail-avatar { width:72px;height:72px;border-radius:19px; }.detail-avatar span { font-size:21px; }.detail-title h1 { font-size:25px; }.detail-hero .primary-button { grid-column:1/-1; width:100%; }.detail-tabs { overflow-x:auto; }.detail-tab { flex:0 0 76px; }.info-grid { gap:8px; }.info-card { min-height:70px; padding:11px; }.info-value { font-size:13px; }
  .floating-add { right:18px; bottom:calc(72px + env(safe-area-inset-bottom)); width:46px;height:46px;border-radius:14px; }
  .mobile-nav { position:fixed; left:0; right:0; bottom:0; z-index:17; height:calc(62px + env(safe-area-inset-bottom)); display:grid; grid-template-columns:repeat(3,1fr); padding:5px 24px env(safe-area-inset-bottom); border-top:1px solid var(--line); background:rgba(250,248,245,.94); backdrop-filter:blur(18px); }
  .mobile-nav-item { position:relative; display:grid; place-items:center; align-content:center; gap:1px; border:0; background:transparent; color:var(--faint); font-size:9px; }.mobile-nav-item.active { color:var(--accent-strong); }.mobile-icon { font-size:20px; line-height:1.1; font-weight:350; }.mobile-nav-item b { position:absolute; top:4px; left:calc(50% + 7px); display:grid; place-items:center; min-width:14px; height:14px; padding:0 3px; border-radius:99px; background:var(--accent); color:#21170f; font-size:8px; }.mobile-nav-item i { position:absolute; top:8px; left:calc(50% + 8px); width:5px;height:5px;border-radius:50%;background:var(--red); }
  .modal-backdrop { align-items:end; padding:0; }.modal-sheet { width:100%; max-height:88dvh; padding:9px 16px calc(20px + env(safe-area-inset-bottom)); border-width:1px 0 0; border-radius:20px 20px 0 0; animation:sheetIn .22s ease both; }.sheet-handle { display:block; width:34px;height:4px;margin:0 auto 14px;border-radius:99px;background:var(--faint); }.quick-grid { grid-template-columns:repeat(2,1fr); }.form-grid { grid-template-columns:1fr; }.field.full { grid-column:auto; }
  .toast { bottom:calc(76px + env(safe-area-inset-bottom)); }
  @keyframes sheetIn { from { transform:translateY(100%); } to { transform:none; } }
}

@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; } }
