@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary: #111111;
  --primary-hover: #2a2a2a;
  --primary-soft: #fff5bf;
  --accent: #ffd700;
  --accent-soft: #fff8cf;
  --background: #f6f4ef;
  --surface: #ffffff;
  --surface-raised: #fffdf8;
  --text: #1a1a1a;
  --text-soft: #6b6259;
  --border: #e8e2d6;
  --danger: #b42318;
  --danger-soft: #fef0ef;
  --warning: #8a4b08;
  --warning-soft: #fff5df;
  --success: #187044;
  --success-soft: #e8f6ed;
  --blue: #265d97;
  --blue-soft: #eaf2fb;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, .06);
  --shadow-md: 0 10px 30px rgba(17, 17, 17, .08);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --content: 1240px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--text); font: 400 1rem/1.55 'DM Sans', system-ui, sans-serif; min-width: 320px; }
body:has(dialog[open]) { overflow: hidden; }
a { color: var(--primary); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, input[type="file"] { touch-action: manipulation; }
button, [role="button"], a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { display: block; max-width: 100%; object-fit: cover; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.15; }
h1 { margin-bottom: .45rem; font: 700 clamp(2rem, 5vw, 3.35rem)/1.04 'DM Sans', system-ui, sans-serif; letter-spacing: -.04em; }
h2 { margin-bottom: .4rem; font-size: 1.35rem; letter-spacing: -.015em; }
h3 { font-size: 1.05rem; }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 1000; background: var(--text); color: white; padding: .75rem 1rem; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 3px solid #f4a340; outline-offset: 3px; }

.page-shell { width: min(100% - 2rem, var(--content)); margin-inline: auto; padding-block: var(--space-6) 7rem; }
.app-header { position: sticky; top: 0; z-index: 50; background: #111; border-bottom: 1px solid #111; }
.header-inner { width: min(100% - 2rem, var(--content)); height: 72px; margin-inline: auto; display: flex; align-items: center; gap: var(--space-6); }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; white-space: nowrap; }
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand strong { font: 700 1.15rem 'DM Sans', system-ui, sans-serif; letter-spacing: -.03em; }
.brand small { color: rgba(255,255,255,.55); font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; background: var(--accent); color: #111; border-radius: 10px; box-shadow: none; }
.brand-mark svg { width: 25px; stroke: none; fill: currentColor; }
.desktop-nav { display: flex; align-items: stretch; align-self: stretch; gap: .15rem; }
.desktop-nav a { position: relative; display: grid; place-items: center; padding: 0 .85rem; color: rgba(255,255,255,.55); text-decoration: none; font-size: .88rem; font-weight: 650; transition: color .2s ease, background .2s ease; }
.desktop-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.desktop-nav a[aria-current="page"] { color: #111; background: var(--accent); border-radius: 8px; align-self: center; height: 40px; }
.desktop-nav a[aria-current="page"]::after { display: none; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: .65rem; font-size: .8rem; color: #fff; }
.user-menu > div { display: grid; line-height: 1.2; }
.user-menu small { color: rgba(255,255,255,.55); }
.user-avatar, .avatar-small { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--accent); color: #111; font-weight: 800; }
.user-avatar { width: 36px; height: 36px; }
.avatar-small { width: 34px; height: 34px; }
.text-button { min-height: 44px; padding: .5rem; border: 0; background: transparent; color: rgba(255,255,255,.7); text-decoration: underline; }
.mobile-nav { position: fixed; z-index: 60; inset: auto 0 0; display: none; grid-template-columns: repeat(4, 1fr); padding: .4rem max(.5rem, env(safe-area-inset-right)) calc(.4rem + env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left)); background: rgba(255,255,255,.98); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(23,33,27,.08); }
.mobile-nav a { min-height: 56px; display: grid; place-items: center; align-content: center; gap: .15rem; color: var(--text-soft); text-decoration: none; font-size: .69rem; font-weight: 700; border-radius: 10px; }
.mobile-nav svg { width: 23px; height: 23px; }
.mobile-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.freshness-banner { background: var(--warning-soft); border-bottom: 1px solid #f0d59c; color: #65370a; font-size: .875rem; }
.freshness-banner .page-shell { padding-block: .65rem; }
.freshness-banner a { color: inherit; font-weight: 700; }
.message-region { position: fixed; top: 84px; right: 1rem; z-index: 200; display: grid; gap: .5rem; width: min(calc(100% - 2rem), 390px); }
.toast { padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md); font-weight: 600; animation: toast-in .25s ease-out; }
.toast-success { border-color: #a6d6b8; background: var(--success-soft); color: #11522f; }
.toast-error { border-color: #efb5b0; background: var(--danger-soft); color: #7f1d17; }

.eyebrow { margin-bottom: .35rem; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-heading { margin-bottom: var(--space-6); }
.page-heading > p:last-child, .profile-heading > p { color: var(--text-soft); }
.heading-with-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.heading-actions { display: flex; gap: .5rem; }
.segmented-control, .tab-row { display: flex; gap: .25rem; padding: .25rem; background: #e8ede8; border-radius: 12px; }
.segmented-control a, .tab-row a { min-height: 44px; display: grid; place-items: center; padding: .5rem 1rem; border-radius: 9px; color: var(--text-soft); text-decoration: none; font-size: .88rem; font-weight: 700; white-space: nowrap; transition: .2s ease; }
.segmented-control a:hover, .tab-row a:hover { color: var(--primary); }
.segmented-control a[aria-current="true"], .tab-row a[aria-current="page"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.tab-row { width: fit-content; max-width: 100%; margin-bottom: var(--space-5); overflow-x: auto; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; margin-bottom: var(--space-4); font-weight: 700; text-decoration: none; }
.back-link svg { width: 20px; }

.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .65rem 1rem; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-weight: 750; line-height: 1.2; transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease; }
.button-primary { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: var(--shadow-sm); }
.button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-secondary { color: var(--primary); background: var(--surface); border-color: #9bb8a4; }
.button-secondary:hover { background: var(--primary-soft); border-color: var(--primary); }
.button-quiet { color: var(--text-soft); background: transparent; }
.button-quiet:hover { background: #edf0ed; color: var(--text); }
.button-small { min-height: 40px; padding: .5rem .75rem; font-size: .82rem; }
.button-full { width: 100%; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.icon-button { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; background: #edf0ed; color: var(--text); }
.icon-button svg { width: 22px; }

.panel { padding: var(--space-5); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.section-heading h2 { margin: 0; }
.section-heading h2 span { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 .4rem; vertical-align: 2px; border-radius: 99px; background: #e8ede8; color: var(--text-soft); font: 700 .75rem Inter, sans-serif; }
.section-heading.compact { margin-bottom: .8rem; }
.operation-section { margin-top: var(--space-8); }
.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.dog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.compact-grid { grid-template-columns: 1fr; }
.dog-card { min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .2s ease, box-shadow .2s ease; }
.dog-card:hover { border-color: #adc2b2; box-shadow: 0 7px 20px rgba(23,33,27,.07); }
.dog-card-main, .dog-card-details { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.dog-card-details { align-items: flex-end; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.dog-identity { min-width: 0; display: inline-flex; align-items: center; gap: .8rem; color: var(--text); text-decoration: none; }
.dog-identity img, .dog-placeholder { width: 60px; height: 60px; flex: 0 0 auto; border-radius: 16px; background: var(--primary-soft); color: var(--primary); }
.dog-placeholder { display: grid; place-items: center; font: 400 1.55rem Calistoga, Georgia, serif; text-transform: uppercase; }
.dog-identity > span:last-child { min-width: 0; display: grid; }
.dog-identity strong { overflow: hidden; font: 400 1.35rem Calistoga, Georgia, serif; text-overflow: ellipsis; }
.dog-identity small { overflow: hidden; color: var(--text-soft); text-overflow: ellipsis; white-space: nowrap; }
.dog-card-details dl { display: flex; gap: 1.25rem; margin: 0; }
.dog-card-details dl div, .service-facts div { display: grid; gap: .1rem; }
dt { color: var(--text-soft); font-size: .69rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
dd { margin: 0; font-size: .84rem; font-weight: 650; }
.service-badge, .status-chip, .confidence, .round-status, .alert-chip { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; font-size: .7rem; font-weight: 800; letter-spacing: .035em; line-height: 1; text-transform: uppercase; white-space: nowrap; }
.service-badge { padding: .55rem .7rem; background: #e8ede8; color: #3f4c43; }
.service-pack_lounge { background: var(--success-soft); color: #115a35; }
.service-paw_pod { background: var(--blue-soft); color: #1f5082; }
.service-alpha_suite { background: #f4ecff; color: #654195; }
.service-daycare { background: var(--accent-soft); color: #804407; }
.service-needs_review { background: var(--warning-soft); color: var(--warning); }
.alert-chip { gap: .3rem; padding: .48rem .6rem; color: var(--danger); background: var(--danger-soft); }
.alert-chip svg { width: 15px; }

.exception-panel { padding: var(--space-4); border: 1px solid #e7ba78; border-radius: var(--radius-lg); background: #fffaf0; }
.exception-list { display: grid; }
.exception-list a { display: grid; grid-template-columns: auto minmax(80px, .45fr) 1fr auto; align-items: center; gap: .75rem; min-height: 48px; padding: .6rem .4rem; color: var(--text); text-decoration: none; border-top: 1px solid #f1dfbf; }
.exception-list a:first-child { border-top: 0; }
.exception-list span:not(.status-dot) { color: var(--text-soft); font-size: .86rem; }
.exception-list small { color: var(--warning); font-weight: 700; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status-danger { background: var(--danger); }
.status-amber { background: #c87810; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); margin-top: var(--space-5); }
.quick-action { min-height: 88px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr 1fr; align-items: center; column-gap: .8rem; padding: .85rem 1rem; color: var(--text); text-decoration: none; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .2s ease, background .2s ease; }
.quick-action:hover { border-color: #9bb8a4; background: var(--primary-soft); }
.quick-action > span { grid-row: 1 / 3; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); }
.quick-action svg { width: 25px; }
.quick-action strong { align-self: end; }
.quick-action small { align-self: start; color: var(--text-soft); }
.empty-state { grid-column: 1 / -1; padding: 2.5rem 1.5rem; text-align: center; border: 1px dashed #bfcac1; border-radius: var(--radius); background: rgba(255,255,255,.5); }
.empty-state h2, .empty-state h3 { margin-bottom: .3rem; }
.empty-state p { margin: 0; color: var(--text-soft); }
.empty-state.small { padding: 1.25rem; }

.search-form { position: relative; display: flex; gap: .75rem; padding: .65rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.search-form svg { position: absolute; left: 1.2rem; top: 50%; width: 23px; color: var(--text-soft); transform: translateY(-50%); }
.search-form input { width: 100%; min-height: 50px; padding: .7rem .8rem .7rem 3rem; border: 0; background: transparent; font-size: 1.05rem; }
.search-form input:focus { outline: none; }
.search-form:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23,97,58,.16); }
.search-results { margin-top: var(--space-6); }
.result-list { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.result-list > a, .static-result { min-height: 76px; display: flex; align-items: center; gap: .85rem; padding: .75rem 1rem; color: var(--text); text-decoration: none; border-top: 1px solid var(--border); }
.result-list > a:first-child { border-top: 0; }
.result-list > a:hover { background: var(--primary-soft); }
.result-list img, .result-list .dog-placeholder { width: 52px; height: 52px; border-radius: 13px; }
.result-list a > span:nth-child(2), .static-result > span { display: grid; }
.result-list small { color: var(--text-soft); }
.result-list a > svg { width: 20px; margin-left: auto; }

.profile-header { display: flex; align-items: center; gap: var(--space-5); margin-bottom: var(--space-5); }
.profile-photo { width: 112px; height: 112px; border-radius: 28px; }
.profile-heading h1 { margin-bottom: .25rem; }
.owner-line { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: .75rem; }
.owner-line a { font-size: .9rem; }
.safety-card { display: flex; gap: 1rem; margin-bottom: var(--space-5); padding: 1.2rem; border: 1px solid #e9aaa5; border-left: 5px solid var(--danger); border-radius: var(--radius); background: var(--danger-soft); }
.safety-card p:last-child { margin-bottom: 0; }
.safety-icon { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--danger); }
.safety-icon svg { width: 24px; }
.profile-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(310px, .7fr); gap: var(--space-5); align-items: start; }
.profile-main, .profile-side { display: grid; gap: var(--space-5); }
.profile-side { position: sticky; top: 96px; }
.date-range { margin: .25rem 0 .65rem; font: 400 1.7rem Calistoga, Georgia, serif; }
.date-range span { color: var(--text-soft); font: 500 .85rem Inter, sans-serif; text-transform: uppercase; }
.fact-row { display: flex; gap: 1.5rem; color: var(--text-soft); font-size: .88rem; }
.timeline { display: grid; gap: .8rem; }
.timeline-item { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-raised); }
.timeline-important { border-color: #e9aaa5; border-left: 4px solid var(--danger); background: #fffafa; }
.timeline-meta { display: flex; align-items: center; gap: .65rem; }
.timeline-meta > div { display: grid; }
.timeline-meta small { color: var(--text-soft); }
.timeline-meta .status-chip { margin-left: auto; }
.timeline-item > p { margin: .9rem 0; }
.timeline-item footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); color: var(--text-soft); font-size: .8rem; }
.status-chip { padding: .42rem .58rem; background: #edf0ed; color: var(--text-soft); }
.status-open, .status-preview, .status-changed { background: var(--warning-soft); color: var(--warning); }
.status-done, .status-applied, .status-unchanged { background: var(--success-soft); color: var(--success); }
.status-failed, .status-error { background: var(--danger-soft); color: var(--danger); }
.status-new { background: var(--blue-soft); color: var(--blue); }
.summary-box { padding: .85rem; border-radius: 10px; background: var(--primary-soft); }
.plan-list { display: grid; gap: .6rem; margin-bottom: var(--space-4); }
.plan-list > div { display: grid; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.plan-list span, .plan-list small, .muted { color: var(--text-soft); }
.care-history-table, .booking-history { display: grid; }
.care-row { display: grid; grid-template-columns: 1fr .8fr 1.1fr 1fr; gap: 1rem; padding: .75rem .5rem; border-top: 1px solid var(--border); font-size: .86rem; }
.care-head { color: var(--text-soft); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border-top: 0; }
.history-row { display: grid; grid-template-columns: 1.5fr auto .5fr; align-items: center; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--border); }
.history-row:first-child { border-top: 0; }
.history-row > div { display: grid; }
.history-row small { color: var(--text-soft); }

.round-progress { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.25rem; margin-bottom: var(--space-5); padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.round-progress > div:first-child { display: grid; min-width: 84px; }
.round-progress > div:first-child strong { font-size: 1.35rem; }
.round-progress > div:first-child span { color: var(--text-soft); font-size: .78rem; }
.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: #e7ebe7; }
.progress-track span { display: block; width: var(--progress); height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
.round-progress dl { display: flex; gap: 1rem; margin: 0; }
.round-progress dl div { display: grid; text-align: center; }
.round-progress dd { font-size: 1rem; }
.inline-warning { margin-bottom: var(--space-5); padding: 1rem; border: 1px solid #e6bf83; border-radius: var(--radius); background: var(--warning-soft); color: #633707; }
.inline-warning p { margin: .25rem 0 0; }
.round-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.meal-card, .service-card { overflow: hidden; border: 1px solid var(--border); border-left-width: 5px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.meal-card > header, .service-card-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem; }
.meal-card .dog-identity img, .meal-card .dog-placeholder { width: 66px; height: 66px; }
.status-border-due { border-left-color: #c87810; }
.status-border-prepared { border-left-color: var(--blue); }
.status-border-fed { border-left-color: #6c4aa2; }
.status-border-observed, .status-border-skipped { border-left-color: var(--success); }
.round-status { padding: .5rem .65rem; background: #edf0ed; }
.round-status-due { background: var(--warning-soft); color: var(--warning); }
.round-status-prepared { background: var(--blue-soft); color: var(--blue); }
.round-status-fed { background: #f1eaff; color: #68419b; }
.round-status-observed, .round-status-skipped { background: var(--success-soft); color: var(--success); }
.allergy-banner { display: flex; align-items: center; gap: .4rem; padding: .7rem 1rem; background: var(--danger-soft); color: #791c16; font-size: .84rem; }
.allergy-banner svg { width: 18px; flex: 0 0 auto; }
.recipe-block { display: grid; grid-template-columns: .55fr 1.45fr; gap: 1rem; padding: 1rem; border-block: 1px solid var(--border); background: var(--surface-raised); }
.recipe-block > div { display: grid; align-content: start; }
.recipe-block span, .staff-stamp span { color: var(--text-soft); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.recipe-block p { margin: .2rem 0 0; font-size: .87rem; }
.meal-actions { display: grid; gap: .75rem; padding: 1rem; }
.staff-stamp { display: grid; padding: .65rem .8rem; border-radius: 10px; background: var(--primary-soft); }
.staff-stamp small { color: var(--text-soft); }
.observation-form, .health-form { display: grid; gap: 1rem; }
.observation-form fieldset, .health-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.observation-form legend, .health-form legend { margin-bottom: .5rem; font-weight: 750; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.choice-grid label, .health-grid label { position: relative; cursor: pointer; }
.choice-grid input, .health-grid input { position: absolute; opacity: 0; }
.choice-grid span, .health-grid label span { min-height: 44px; display: grid; place-items: center; padding: .35rem; text-align: center; border: 1px solid #abb9ae; border-radius: 9px; background: var(--surface); color: var(--text-soft); font-size: .78rem; font-weight: 700; }
.choice-grid input:checked + span, .health-grid input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.choice-grid input:focus-visible + span, .health-grid input:focus-visible + span { outline: 3px solid #f4a340; outline-offset: 2px; }
.completed-summary { display: flex; align-items: flex-start; gap: .8rem; padding: .8rem; border-radius: 12px; background: var(--success-soft); }
.completed-summary > svg { width: 28px; height: 28px; padding: .25rem; flex: 0 0 auto; border-radius: 50%; background: var(--success); color: #fff; }
.completed-summary > div { display: grid; }
.completed-summary span, .completed-summary small { color: #315d42; }
.completed-summary > a { margin-left: auto; }
.completed-summary img { width: 72px; height: 72px; border-radius: 10px; }
.health-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; }
.health-grid fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.health-grid fieldset:nth-child(3) { grid-template-columns: repeat(3, 1fr); }
.health-grid legend { grid-column: 1 / -1; font-size: .82rem; }

.service-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.service-card { border-left-color: #c87810; }
.confidence { padding: .5rem .65rem; }
.confidence-exact { background: var(--success-soft); color: var(--success); }
.confidence-likely { background: var(--warning-soft); color: var(--warning); }
.confidence-review { background: var(--danger-soft); color: var(--danger); }
.service-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 0; padding: 1rem; border-block: 1px solid var(--border); background: var(--surface-raised); }
.inference { padding: 1rem; }
.inference p { margin: .3rem 0 0; color: var(--text-soft); font-size: .86rem; }
.confirmed-box { display: grid; margin: 0 1rem 1rem; padding: .75rem; border-radius: 10px; background: var(--success-soft); color: #205739; }
.confirmed-box span { font-size: .8rem; }
.service-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; padding: 0 1rem 1rem; }
.recipe-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr); gap: var(--space-5); align-items: start; }
.recipe-list { display: grid; gap: var(--space-4); }
.recipe-card .section-heading > div { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.recipe-card p { color: var(--text-soft); }
.recipe-card > small { color: var(--text-soft); }
.recipe-form { position: sticky; top: 96px; }
.narrow-panel { max-width: 700px; }

.field, .stack-form > div:has(> input), .stack-form > div:has(> textarea), .stack-form > div:has(> select) { display: grid; gap: .35rem; }
.stack-form { display: grid; gap: 1rem; }
.field label, .stack-form label { font-size: .83rem; font-weight: 750; }
.field label span, .photo-field label span { color: var(--text-soft); font-weight: 500; }
input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="tel"], input[type="time"], input[type="datetime-local"], input[type="number"], select, textarea { width: 100%; min-height: 46px; padding: .7rem .8rem; border: 1px solid #aebbb1; border-radius: 9px; background: #fff; color: var(--text); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(23,97,58,.15); }
input[type="file"] { width: 100%; min-height: 46px; padding: .55rem; border: 1px solid #aebbb1; border-radius: 9px; background: #fff; }
.check-field { display: flex!important; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
.check-field input { width: 20px; height: 20px; accent-color: var(--primary); }
.helptext, .help-text { color: var(--text-soft); font-size: .78rem; }
.errorlist, .form-error { margin: 0; padding: .75rem; border-radius: 9px; background: var(--danger-soft); color: var(--danger); list-style: none; font-size: .85rem; }
.compact-form { gap: .8rem; }
.app-dialog { width: min(calc(100% - 2rem), 560px); max-height: min(760px, calc(100dvh - 2rem)); overflow: auto; padding: 1.25rem; border: 0; border-radius: var(--radius-lg); box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.app-dialog::backdrop { background: rgba(12,22,15,.58); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.dialog-heading h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }

.import-layout { display: grid; grid-template-columns: 1.4fr .6fr; gap: var(--space-5); }
.drop-zone { min-height: 230px; display: grid!important; place-items: center; align-content: center; gap: .45rem; padding: 1.5rem; border: 2px dashed #9eb4a3; border-radius: var(--radius); background: var(--primary-soft); text-align: center; cursor: pointer; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--primary); background: #dff0e5; }
.drop-zone svg { width: 38px; color: var(--primary); }
.drop-zone strong { font-size: 1.05rem; }
.drop-zone span { color: var(--text-soft); font-weight: 500; }
.drop-zone input { width: auto; min-height: auto; padding: .5rem; border: 0; background: transparent; }
.check-list { display: grid; gap: .75rem; padding: 0; list-style: none; }
.check-list li { position: relative; padding-left: 1.6rem; }
.check-list li::before { content: ""; position: absolute; left: 0; top: .25rem; width: 14px; height: 8px; border: solid var(--primary); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.import-history { margin-top: var(--space-5); }
.data-table { overflow-x: auto; }
.table-row { min-width: 680px; display: grid; grid-template-columns: 1.5fr 1fr .8fr .5fr 1fr; align-items: center; gap: .8rem; min-height: 54px; padding: .65rem .4rem; color: var(--text); text-decoration: none; border-top: 1px solid var(--border); }
a.table-row:hover { background: var(--primary-soft); }
.table-head { min-height: 36px; color: var(--text-soft); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border-top: 0; }
.import-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: .75rem; margin-bottom: var(--space-5); }
.import-summary > div { display: grid; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.import-summary strong { font-size: 1.6rem; }
.import-summary span { color: var(--text-soft); font-size: .78rem; }
.summary-new strong { color: var(--blue); }
.summary-changed strong { color: var(--warning); }
.summary-error strong { color: var(--danger); }
.apply-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: var(--space-5); padding: 1rem 1.2rem; border: 1px solid #a7cfb5; border-radius: var(--radius); background: var(--success-soft); }
.apply-panel p { margin: .2rem 0 0; color: #315d42; }
.apply-panel form { display: grid; gap: .3rem; text-align: center; }
.apply-panel small { color: var(--danger); max-width: 250px; }
.import-table .table-row { grid-template-columns: .35fr .7fr 1.7fr 1.25fr; }
.import-table .table-row > span:nth-child(3) { display: grid; }

.login-shell { min-height: 100dvh; display: grid; place-items: center; padding-block: 2rem; }
.login-card { width: min(100%, 470px); padding: clamp(1.5rem, 5vw, 2.5rem); border: 1px solid var(--border); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-md); }
.login-brand { margin-bottom: 1.8rem; text-align: center; }
.brand-mark-large { width: 62px; height: 62px; margin: 0 auto 1rem; border-radius: 18px; }
.brand-mark-large svg { width: 36px; }
.login-brand h1 { font-size: 2.3rem; }
.login-brand p:last-child { color: var(--text-soft); }

@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto!important; animation-duration: .01ms!important; animation-iteration-count: 1!important; transition-duration: .01ms!important; } }

@media (max-width: 980px) {
  .desktop-nav { display: none; }
  .mobile-nav { display: grid; }
  .page-shell { padding-bottom: 6.5rem; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-side { position: static; grid-template-columns: repeat(2, 1fr); }
  .round-list, .service-list { grid-template-columns: 1fr; }
  .recipe-layout { grid-template-columns: 1fr; }
  .recipe-form { position: static; }
}

@media (max-width: 720px) {
  .page-shell, .header-inner { width: min(100% - 1.25rem, var(--content)); }
  .header-inner { height: 62px; }
  .user-menu > div, .user-avatar, .user-menu .text-button { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .freshness-banner .page-shell { padding-block: .6rem; }
  .page-shell { padding-top: 1.25rem; }
  .heading-with-actions { align-items: stretch; flex-direction: column; }
  .heading-with-actions > .button { width: 100%; }
  .heading-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .segmented-control { width: 100%; }
  .segmented-control a { flex: 1; }
  .quick-actions, .dashboard-columns, .dog-grid, .profile-side, .import-layout { grid-template-columns: 1fr; }
  .quick-action { min-height: 76px; }
  .dog-card-details { align-items: flex-start; flex-direction: column; }
  .dog-card-details dl { width: 100%; justify-content: space-between; gap: .6rem; }
  .exception-list a { grid-template-columns: auto 1fr auto; }
  .exception-list a span:not(.status-dot) { grid-column: 2 / 4; }
  .section-heading { align-items: stretch; }
  .section-heading .button { align-self: center; }
  .profile-header { align-items: flex-start; }
  .profile-photo { width: 88px; height: 88px; border-radius: 22px; }
  .owner-line { display: grid; gap: .25rem; }
  .timeline-item footer { align-items: flex-start; flex-direction: column; }
  .care-row { grid-template-columns: 1fr 1fr; }
  .care-head { display: none; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row > span:last-child { grid-column: 1 / -1; }
  .round-progress { grid-template-columns: auto 1fr; }
  .round-progress dl { grid-column: 1 / -1; justify-content: space-around; padding-top: .75rem; border-top: 1px solid var(--border); }
  .service-actions { grid-template-columns: 1fr; }
  .search-form { display: grid; }
  .search-form svg { top: 34px; }
  .search-form .button { width: 100%; }
  .import-summary { grid-template-columns: repeat(2, 1fr); }
  .import-summary > div:first-child { grid-column: 1 / -1; }
  .apply-panel { align-items: stretch; flex-direction: column; }
}

@media (max-width: 430px) {
  body { font-size: .96rem; }
  h1 { font-size: 2rem; }
  .panel { padding: 1rem; }
  .dog-card-main { align-items: flex-start; }
  .alert-chip { padding: .45rem; }
  .alert-chip svg { width: 16px; }
  .alert-chip { font-size: 0; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .health-grid { grid-template-columns: 1fr; }
  .profile-header { gap: 1rem; }
  .profile-photo { width: 72px; height: 72px; border-radius: 18px; }
  .safety-card { align-items: flex-start; }
  .safety-icon { display: none; }
  .date-range { font-size: 1.4rem; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

@media print {
  body { background: #fff; font-size: 10pt; }
  .app-header, .mobile-nav, .freshness-banner, .message-region, .quick-actions, .button, .tab-row { display: none!important; }
  .page-shell { width: 100%; padding: 0; }
  .dog-grid, .dashboard-columns { grid-template-columns: repeat(2, 1fr); }
  .dog-card, .panel { break-inside: avoid; box-shadow: none; }
}

/* Payroll-family application shell */
body { height: 100dvh; overflow: hidden; font-size: 13px; background: #f6f4ef; }
.app-shell { display: flex; height: 100dvh; overflow: hidden; }
.sidebar { width: 254px; flex: 0 0 254px; display: flex; flex-direction: column; padding: 14px 12px 18px; background: #111; color: #fff; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; min-height: 72px; margin: -14px -12px 17px; padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.sidebar-brand-mark { display: grid; place-items: center; width: 34px; height: 34px; color: var(--accent); }
.sidebar-brand-mark svg { width: 27px; height: 27px; stroke-width: 2.15; }
.sidebar-brand > span:last-child { display: grid; gap: 1px; line-height: 1; }
.sidebar-brand strong { font-size: 1.19rem; font-weight: 800; letter-spacing: -.045em; }
.sidebar-brand small { color: var(--accent); font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-nav { display: flex; flex: 1; flex-direction: column; gap: 2px; }
.sidebar-label { margin: 16px 2px 5px; color: rgba(255,215,0,.72); font-size: .63rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-label:first-child { margin-top: 9px; }
.sidebar-nav a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 10px; color: rgba(255,255,255,.9); font-size: .91rem; font-weight: 750; text-decoration: none; transition: background-color .18s ease, color .18s ease; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); }
.sidebar-nav a[aria-current="page"] { background: var(--accent); color: #111; }
.sidebar-footer { margin-top: 20px; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.09); color: rgba(255,255,255,.42); font-size: .72rem; }
.main-area { min-width: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { min-height: 66px; display: flex; align-items: center; gap: 16px; padding: 0 34px; background: #fff; border-bottom: 1px solid var(--border); }
.global-search { position: relative; width: min(100%, 540px); }
.global-search svg { position: absolute; top: 50%; left: 15px; width: 18px; color: var(--text-soft); transform: translateY(-50%); }
.global-search input { min-height: 42px; padding: .55rem 1rem .55rem 43px; border-color: #dce2eb; border-radius: 12px; color: var(--text); font-size: .9rem; }
.global-search input::placeholder { color: #99a4bd; }
.topbar-account { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-account > span:last-of-type { display: grid; line-height: 1.17; }
.topbar-account strong { font-size: .8rem; }
.topbar-account small { color: var(--text-soft); font-size: .68rem; }
.user-avatar { width: 36px; height: 36px; background: #fff0b8; font-size: .78rem; }
.topbar-signout { min-height: 36px; padding: .25rem .45rem; border: 0; background: transparent; color: var(--text-soft); font-size: .76rem; font-weight: 700; text-decoration: underline; }
.content-area { position: relative; flex: 1; overflow: auto; }
.page-shell { width: min(100% - 64px, 1440px); margin: 0 auto; padding: 29px 0 56px; }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin-bottom: .45rem; font-size: clamp(2rem, 3vw, 2.35rem); letter-spacing: -.05em; }
.page-heading > p:last-child, .profile-heading > p { font-size: .9rem; }
.eyebrow { margin-bottom: .25rem; color: #8b6d00; font-size: .64rem; }
.freshness-banner { margin: 0; padding: 10px 32px; border-bottom: 1px solid #efd79c; font-size: .84rem; }
.freshness-banner .page-shell { padding: 0; }
.message-region { position: fixed; top: 78px; right: 28px; }
.panel, .dog-card, .meal-card, .service-card, .result-list { border-radius: 14px; box-shadow: 0 7px 22px rgba(17,17,17,.035); }
.panel { padding: 18px 20px; }
.quick-actions { gap: 14px; margin-top: 0; }
.quick-action { min-height: 90px; border-radius: 14px; box-shadow: none; }
.quick-action:hover { border-color: #d3c166; background: #fffaf0; }
.quick-action > span { border-radius: 10px; background: #fff0b8; }
.operation-section { margin-top: 36px; }
.section-heading { margin-bottom: 12px; }
.section-heading h2 { font-size: 1.2rem; }
.section-heading h2 span { background: #ece9e1; }
.empty-state { border-color: #d7d1c5; border-radius: 14px; background: rgba(255,255,255,.65); }
.segmented-control { background: #ecefe9; border-radius: 12px; }
.segmented-control a { min-height: 40px; font-size: .82rem; }
.button { min-height: 40px; border-radius: 10px; font-size: .84rem; }
.button-primary { background: var(--accent); border-color: var(--accent); color: #111; }
.button-primary:hover { background: #e9c500; border-color: #e9c500; }
.button-secondary { border-color: #dce2eb; }

@media (max-width: 980px) {
  body { height: auto; overflow: auto; }
  .app-shell { height: auto; min-height: 100dvh; }
  .sidebar { width: 210px; flex-basis: 210px; }
  .topbar { padding-inline: 20px; }
  .page-shell { width: min(100% - 40px, 1440px); }
  .global-search { width: 360px; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; min-height: auto; padding: 0 12px 10px; overflow: visible; }
  .sidebar-brand { min-height: 57px; margin: 0 -12px 7px; padding: 10px 18px; }
  .sidebar-brand-mark { width: 29px; height: 29px; }
  .sidebar-brand strong { font-size: 1rem; }
  .sidebar-nav { flex: unset; flex-flow: row wrap; gap: 5px; }
  .sidebar-label, .sidebar-footer { display: none; }
  .sidebar-nav a { min-height: 36px; padding: 0 9px; font-size: .76rem; }
  .topbar { min-height: 58px; padding: 8px 14px; }
  .topbar-account > span:last-of-type, .topbar-signout { display: none; }
  .global-search { width: 100%; }
  .content-area { overflow: visible; }
  .page-shell { width: min(100% - 28px, 1440px); padding-top: 21px; }
  .freshness-banner { padding-inline: 14px; }
  .message-region { top: 70px; right: 14px; }
}
