:root {
  color-scheme: light;
  --cream: var(--canvas);
  --surface: var(--paper);
  --surface-soft: var(--canvas-strong);
  --action: var(--brand-primary);
  --moss-soft: var(--moss-pale);
  --terra: var(--danger);
  --terra-soft: var(--danger-soft);
  --muted: var(--ink-soft);
  --radius: var(--radius-md);
  font-family: var(--font-sans);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; line-height: 1.6; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { width: min(calc(100% - 40px), 1200px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.records-main { padding-top: 34px; padding-bottom: 52px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 8px; color: var(--brand-primary); font-size: 12px; font-weight: 800; letter-spacing: .11em; }
.eyebrow span { color: var(--moss); padding-inline: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 8px; color: var(--forest); font-size: clamp(28px, 4vw, 38px); line-height: 1.25; letter-spacing: -.025em; }
.lede { margin: 0; color: var(--muted); font-size: 16px; }
.privacy-pill { display: inline-flex; flex: none; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--glass-a-border); border-radius: 999px; background: var(--glass-a-bg); box-shadow: var(--glass-a-shadow), var(--glass-a-highlight); backdrop-filter: var(--glass-a-blur); -webkit-backdrop-filter: var(--glass-a-blur); color: var(--forest); font-size: 13px; font-weight: 700; }
.privacy-pill span { font-size: 9px; color: var(--brand-primary); }

.privacy-note { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-top: 1px solid var(--glass-b-border-top); border-left: 1px solid var(--glass-b-border-left); border-right: 1px solid var(--glass-b-border-right); border-bottom: 1px solid var(--glass-b-border-bottom); border-radius: 16px; background: var(--glass-b-bg); box-shadow: var(--glass-b-shadow), var(--glass-b-highlight); backdrop-filter: var(--glass-b-blur); -webkit-backdrop-filter: var(--glass-b-blur); }
.privacy-icon { display: grid; width: 38px; height: 38px; flex: none; place-items: center; border-radius: 12px; background: rgba(232, 244, 226, 0.84); border: 1px solid rgba(39, 103, 63, 0.24); color: var(--forest); font-size: 22px; }
.privacy-note strong { display: block; margin-bottom: 2px; color: var(--forest); font-size: 14px; }
.privacy-note p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.backup-actions { display: flex; flex: none; gap: 8px; margin-left: auto; }

.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid transparent; border-radius: 11px; font-size: 14px; font-weight: 750; transition: background .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-border); box-shadow: var(--btn-primary-shadow); color: #fff; text-shadow: 0 1px 1px rgba(10, 34, 18, 0.26); }
.button-primary:hover { background: var(--btn-primary-bg-hover); }
.button-primary:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.button-soft { border-color: var(--btn-secondary-border); background: var(--btn-secondary-bg); box-shadow: var(--btn-secondary-shadow); backdrop-filter: var(--glass-a-blur); -webkit-backdrop-filter: var(--glass-a-blur); color: var(--forest); }
.button-soft:hover { background: var(--btn-secondary-bg-hover); }
.button-outline { border-color: var(--btn-secondary-border); background: rgba(255, 255, 255, 0.82); box-shadow: var(--btn-secondary-shadow); color: var(--forest); }
.button-outline:hover { background: rgba(255, 255, 255, 0.94); }
.button-quiet { border-color: rgba(188, 111, 60, 0.32); background: rgba(252, 243, 235, 0.78); color: #7a4620; }
.button-quiet:hover { background: rgba(252, 243, 235, 0.92); }
.button-danger { border-color: #963f32; background: #963f32; color: #fff; }
.button-danger:hover { background: #7e3429; }

.status-message { margin: 14px 0 0; padding: 11px 14px; border: 1px solid rgba(39, 103, 63, 0.28); border-radius: 12px; background: rgba(232, 244, 226, 0.84); color: var(--forest); font-size: 14px; font-weight: 700; }
.status-message.error { border-color: rgba(188, 111, 60, 0.36); background: rgba(252, 243, 235, 0.88); color: #78372d; }
.pet-picker { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 26px 0 16px; }
.pet-picker label { display: block; margin-bottom: 6px; color: var(--forest); font-size: 13px; font-weight: 800; }
.pet-picker select { width: min(360px, 54vw); min-height: 46px; padding: 8px 42px 8px 13px; border: 1px solid rgba(39, 103, 63, 0.28); border-radius: 12px; background: rgba(255, 255, 255, 0.88); box-shadow: inset 0 1px 2px rgba(16, 46, 26, 0.04); font-size: 16px; }
.pet-count { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.picker-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.content-area { min-height: 250px; }
.loading-state, .empty-state, .storage-error { display: grid; justify-items: center; gap: 9px; padding: 54px 24px; border-top: 1px solid var(--glass-c-border-top); border-left: 1px solid var(--glass-c-border-left); border-right: 1px solid var(--glass-c-border-right); border-bottom: 1px solid var(--glass-c-border-bottom); border-radius: var(--radius); background: var(--glass-c-bg); box-shadow: var(--glass-c-shadow), var(--glass-c-highlight); backdrop-filter: var(--glass-c-blur); -webkit-backdrop-filter: var(--glass-c-blur); text-align: center; }
.loading-state { color: var(--muted); }
.empty-illustration { display: grid; width: 60px; height: 60px; place-items: center; margin-bottom: 2px; border-radius: 20px; background: rgba(232, 244, 226, 0.88); border: 1px solid rgba(39, 103, 63, 0.24); color: var(--forest); font-size: 28px; }
.empty-state h2, .storage-error h2 { margin: 0; color: var(--forest); font-size: 21px; }
.empty-state p, .storage-error p { max-width: 520px; margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.storage-error { border-color: rgba(188, 111, 60, 0.36); background: rgba(252, 243, 235, 0.88); }
.storage-error h2 { color: var(--terra); }
.storage-error .button { margin-top: 4px; }

.pet-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-top: 1px solid var(--glass-c-border-top); border-left: 1px solid var(--glass-c-border-left); border-right: 1px solid var(--glass-c-border-right); border-bottom: 1px solid var(--glass-c-border-bottom); border-radius: var(--radius); background: var(--glass-c-bg); box-shadow: var(--glass-c-shadow), var(--glass-c-highlight); backdrop-filter: var(--glass-c-blur); -webkit-backdrop-filter: var(--glass-c-blur); }
.pet-identity { min-width: 0; }
.pet-species { display: inline-flex; align-items: center; min-height: 26px; margin-bottom: 5px; padding: 1px 9px; border-radius: 999px; background: rgba(232, 244, 226, 0.88); border: 1px solid rgba(39, 103, 63, 0.24); color: var(--forest); font-size: 12px; font-weight: 700; }
.pet-summary h2 { margin: 0; color: var(--forest); font-size: 25px; line-height: 1.3; overflow-wrap: anywhere; }
.pet-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.pet-notes { max-width: 360px; margin: 0; color: var(--ink-soft); font-size: 14px; }
.pet-delete { margin-left: auto; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.metric { min-height: 114px; padding: 16px 18px; border-top: 1px solid var(--glass-b-border-top); border-left: 1px solid var(--glass-b-border-left); border-right: 1px solid var(--glass-b-border-right); border-bottom: 1px solid var(--glass-b-border-bottom); border-radius: 16px; background: var(--glass-b-bg); box-shadow: var(--glass-b-shadow), var(--glass-b-highlight); backdrop-filter: var(--glass-b-blur); -webkit-backdrop-filter: var(--glass-b-blur); }
.metric-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric-value { display: block; color: var(--forest); font-size: 24px; font-weight: 800; line-height: 1.25; }
.metric-caption { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.records-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .85fr); align-items: start; gap: 14px; }
.panel { min-width: 0; padding: 19px 20px; border-top: 1px solid var(--glass-c-border-top); border-left: 1px solid var(--glass-c-border-left); border-right: 1px solid var(--glass-c-border-right); border-bottom: 1px solid var(--glass-c-border-bottom); border-radius: var(--radius); background: var(--glass-c-bg); box-shadow: var(--glass-c-shadow), var(--glass-c-highlight); backdrop-filter: var(--glass-c-blur); -webkit-backdrop-filter: var(--glass-c-blur); }
.panel + .panel { margin-top: 14px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-heading h2 { margin: 0; color: var(--forest); font-size: 18px; line-height: 1.35; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.weight-chart { width: 100%; min-height: 200px; overflow: visible; }
.chart-gridline { stroke: rgba(39, 103, 63, 0.14); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--brand-primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: #fff; stroke: var(--brand-primary); stroke-width: 3; }
.chart-label { fill: var(--ink-soft); font-size: 11px; }
.chart-empty { display: grid; min-height: 175px; place-items: center; padding: 18px; border-radius: 14px; background: rgba(242, 249, 238, 0.78); border: 1px solid rgba(39, 103, 63, 0.18); color: var(--muted); text-align: center; font-size: 14px; }
.chart-empty strong { display: block; margin-bottom: 4px; color: var(--forest); }
.weight-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.weight-list li { padding: 5px 9px; border-radius: 9px; background: rgba(232, 244, 226, 0.84); border: 1px solid rgba(39, 103, 63, 0.20); color: var(--forest); font-size: 12px; font-weight: 700; }

.feeding-calendar { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); grid-auto-columns: minmax(10px, 1fr); gap: 5px; justify-content: space-between; overflow-x: auto; padding: 3px 1px 7px; }
.calendar-cell { width: 100%; min-width: 9px; max-width: 16px; height: 13px; border-radius: 4px; background: rgba(39, 103, 63, 0.10); }
.calendar-cell[data-level="1"] { background: #cfe6c6; }.calendar-cell[data-level="2"] { background: #97c888; }.calendar-cell[data-level="3"] { background: #5da650; }.calendar-cell[data-level="4"] { background: var(--brand-primary); }
.calendar-legend { display: flex; align-items: center; gap: 5px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.calendar-legend .calendar-cell { width: 13px; min-width: 13px; }
.calendar-caption { margin: 9px 0 0; color: var(--muted); font-size: 12px; }

.timeline-head { align-items: center; }
.timeline-filter { min-height: 40px; max-width: 170px; padding: 6px 32px 6px 10px; border: 1px solid rgba(39, 103, 63, 0.28); border-radius: 10px; background: rgba(255, 255, 255, 0.88); font-size: 14px; }
.timeline { display: grid; gap: 10px; }
.record-item { padding: 14px 15px; border: 1px solid rgba(39, 103, 63, 0.22); border-radius: 14px; background: rgba(248, 252, 245, 0.88); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82); }
.record-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.record-kind { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 5px; color: var(--forest); font-size: 15px; font-weight: 800; }
.record-kind::before { content: ""; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--brand-primary); }
.record-item[data-type="weight"] .record-kind::before { background: #527b9b; }
.record-item[data-type="shed"] .record-kind::before { background: #a68761; }
.record-item[data-type="health"] .record-kind::before { background: #d17c65; }
.record-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.record-summary { margin: 0; color: var(--ink); font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.record-notes { margin: 6px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.record-actions { display: flex; gap: 4px; margin: -7px -7px 0 0; }
.text-button { min-width: 44px; min-height: 44px; padding: 4px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.text-button:hover { background: rgba(232, 244, 226, 0.72); color: var(--forest); }
.text-button.danger { color: var(--terra); }.text-button.danger:hover { background: rgba(252, 243, 235, 0.84); }
.timeline-empty { padding: 28px 18px; border: 1px dashed rgba(39, 103, 63, 0.30); border-radius: 14px; background: rgba(242, 249, 238, 0.64); color: var(--muted); text-align: center; font-size: 14px; }
.timeline-empty strong { display: block; margin-bottom: 4px; color: var(--forest); }
.records-note { padding: 14px 16px; border-radius: 14px; background: var(--glass-b-bg); border: 1px solid var(--glass-b-border); box-shadow: var(--glass-b-shadow), var(--glass-b-highlight); backdrop-filter: var(--glass-b-blur); -webkit-backdrop-filter: var(--glass-b-blur); color: var(--ink-soft); font-size: 13px; }
.records-note strong { color: var(--forest); }

.site-footer { border-top: 1px solid var(--glass-a-border); background: var(--glass-a-bg); backdrop-filter: var(--glass-a-blur); -webkit-backdrop-filter: var(--glass-a-blur); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; color: var(--muted); font-size: 13px; }
.footer-inner a { color: var(--brand-primary); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }

.dialog { width: min(600px, calc(100% - 28px)); max-height: min(88vh, 860px); padding: 24px; border-top: 1px solid var(--glass-c-border-top); border-left: 1px solid var(--glass-c-border-left); border-right: 1px solid var(--glass-c-border-right); border-bottom: 1px solid var(--glass-c-border-bottom); border-radius: 22px; background: var(--glass-c-bg); color: var(--ink); box-shadow: 0 24px 64px rgba(12, 34, 20, 0.24), var(--glass-c-highlight); backdrop-filter: var(--glass-c-blur); -webkit-backdrop-filter: var(--glass-c-blur); overflow: auto; }
.dialog::backdrop { background: rgba(15, 29, 19, 0.42); backdrop-filter: blur(4px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.dialog-heading .eyebrow { margin-bottom: 2px; font-size: 11px; }
.dialog-heading h2 { margin: 0; color: var(--forest); font-size: 24px; }
.icon-button { display: grid; width: 44px; height: 44px; flex: none; place-items: center; border: 1px solid var(--btn-secondary-border); border-radius: 50%; background: var(--btn-secondary-bg); box-shadow: var(--btn-secondary-shadow); color: var(--forest); font-size: 27px; line-height: 1; }
.field { display: grid; gap: 6px; margin-bottom: 14px; color: var(--forest); font-size: 14px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid rgba(39, 103, 63, 0.30); border-radius: 11px; background: rgba(255, 255, 255, 0.88); box-shadow: inset 0 1px 2px rgba(16, 46, 26, 0.04); font-size: 16px; font-weight: 400; }
.field textarea { min-height: 88px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-faint); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.required { margin-left: 5px; color: #824419; font-size: 11px; font-weight: 750; }
.type-fields { padding-top: 2px; }
.field-hint { margin: -8px 0 12px; color: var(--muted); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(39, 103, 63, 0.16); }
.form-error { margin: 0; padding: 9px 11px; border-radius: 10px; background: rgba(252, 243, 235, 0.88); border: 1px solid rgba(188, 111, 60, 0.34); color: var(--terra); font-size: 13px; }

.share-dialog { width: min(920px, calc(100% - 28px)); max-height: min(calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 960px); }
.share-source { display: grid; gap: 5px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid rgba(188, 111, 60, 0.30); border-radius: 14px; background: rgba(252, 243, 235, 0.82); }
.share-source .eyebrow { margin: 0; color: #79543d; font-size: 11px; }
.share-source strong { color: #4d493e; font-size: 15px; }
.share-source > span:last-of-type { color: var(--muted); font-size: 13px; }
.share-source p { margin: 0; color: #554b40; font-size: 14px; }
.share-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.share-selection, .share-preview { min-width: 0; padding: 16px; border: 1px solid rgba(39, 103, 63, 0.22); border-radius: 15px; background: rgba(248, 252, 245, 0.88); }
.share-selection h3, .share-preview h3 { margin: 0; color: var(--forest); font-size: 16px; }
.share-selection > p { margin: 4px 0 12px; color: var(--muted); font-size: 13px; }
.share-fields { display: grid; gap: 7px; }
.share-field { display: flex; min-height: 52px; align-items: center; gap: 11px; padding: 8px 10px; border: 1px solid rgba(39, 103, 63, 0.22); border-radius: 11px; background: rgba(255, 255, 255, 0.82); cursor: pointer; }
.share-field:has(input:checked) { border-color: var(--brand-primary); background: rgba(232, 244, 226, 0.88); }
.share-field input { width: 20px; height: 20px; flex: none; accent-color: var(--brand-primary); }
.share-field span { display: grid; min-width: 0; gap: 2px; }
.share-field strong { color: var(--forest); font-size: 14px; }
.share-field small { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.share-preview { background: rgba(242, 249, 238, 0.84); }
.share-preview .panel-heading { margin-bottom: 12px; }
.share-preview .panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.share-preview-empty { display: grid; min-height: 160px; place-items: center; padding: 20px; border: 1px dashed rgba(39, 103, 63, 0.30); border-radius: 12px; color: var(--muted); font-size: 14px; text-align: center; }
.public-draft-card { padding: 16px; border: 1px solid rgba(39, 103, 63, 0.24); border-radius: 13px; background: rgba(255, 255, 255, 0.90); }
.public-draft-card .privacy-pill { min-height: 30px; margin: 0; font-size: 12px; }
.public-draft-card dl { display: grid; gap: 0; margin: 12px 0 0; }
.public-draft-card dl > div { display: grid; grid-template-columns: minmax(78px, .7fr) minmax(0, 1.3fr); gap: 12px; padding: 10px 0; border-top: 1px solid rgba(39, 103, 63, 0.14); }
.public-draft-card dt { color: var(--muted); font-size: 13px; }
.public-draft-card dd { margin: 0; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.share-boundary { display: grid; gap: 5px; margin-top: 14px; padding: 12px 14px; border: 1px solid rgba(39, 103, 63, 0.24); border-radius: 12px; background: rgba(232, 244, 226, 0.72); color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.share-boundary strong { color: var(--forest); }
.share-boundary span { color: #824419; }
.share-dialog .dialog-actions { position: sticky; bottom: -24px; z-index: 2; justify-content: space-between; margin-bottom: -24px; padding: 14px 0 24px; background: linear-gradient(to bottom, rgba(242, 249, 238, 0.92), var(--glass-c-bg) 12px); }
.share-dialog [hidden] { display: none !important; }
.share-dialog .dialog-actions .button { min-height: 44px; }
.share-dialog .button:disabled { cursor: not-allowed; opacity: .55; transform: none; }

@media (max-width: 760px) {
  .wrap { width: min(calc(100% - 28px), 1200px); }
  .nav { min-height: 60px; gap: 8px; }
  .nav-links { gap: 2px; }
  .nav-link { padding-inline: 9px; font-size: 12px; }
  .primary-action { min-height: 42px; padding-inline: 12px; font-size: 13px; }
  .records-main { padding-top: 24px; padding-bottom: 36px; }
  .page-heading { display: block; margin-bottom: 17px; }
  h1 { font-size: 28px; }
  .privacy-pill { margin-top: 13px; }
  .privacy-note { align-items: flex-start; flex-wrap: wrap; padding: 14px; }
  .privacy-note > div:nth-child(2) { flex: 1; min-width: 210px; }
  .backup-actions { width: calc(100% - 52px); margin-left: 52px; }
  .backup-actions .button { flex: 1; }
  .pet-picker { align-items: stretch; flex-direction: column; margin-top: 20px; }
  .pet-picker select { width: 100%; }
  .picker-actions { display: grid; grid-template-columns: 1fr 1.1fr; }
  .picker-actions #addPetButton { grid-column: 1; }
  .picker-actions #editPetButton { grid-column: 2; grid-row: 1; }
  .picker-actions #addRecordButton { grid-column: 1 / -1; }
  .pet-summary { align-items: flex-start; flex-direction: column; padding: 17px; }
  .pet-summary h2 { font-size: 23px; }
  .pet-notes { max-width: none; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .metric { min-height: 100px; padding: 12px 10px; }
  .metric-label { min-height: 35px; margin-bottom: 5px; font-size: 12px; }
  .metric-value { font-size: 19px; }
  .metric-caption { font-size: 11px; }
  .records-columns { grid-template-columns: 1fr; }
  .records-columns > aside { display: block; }
  .panel { padding: 16px; }
  .weight-chart { min-height: 180px; }
  .timeline-head { align-items: flex-start; }
  .timeline-filter { max-width: 140px; }
  .record-item { padding: 13px; }
  .dialog { padding: 20px 17px; border-radius: 18px; }
  .share-columns { grid-template-columns: 1fr; }
  .share-preview-empty { min-height: 120px; }
  .share-dialog { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: max(16px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; }
  .share-dialog[data-step="select"] .share-preview { display: none; }
  .share-dialog[data-step="preview"] .share-selection { display: none; }
  .share-dialog[data-step="preview"] .share-preview { display: block; }
  .share-dialog #previewPublicDraft { display: inline-flex; }
  .share-dialog #copyPublicDraft { display: none; }
  .share-dialog[data-step="preview"] #previewPublicDraft { display: none; }
  .share-dialog[data-step="preview"] #backToShareSelection,
  .share-dialog[data-step="preview"] #copyPublicDraft { display: inline-flex; }
  .share-dialog .dialog-actions { bottom: 0; margin-bottom: 0; padding: 14px 0 max(12px, env(safe-area-inset-bottom)); }
  .share-dialog .dialog-actions .button { width: 100%; }
}

@media (max-width: 640px) {
  .site-header__inner { flex-wrap: wrap; padding-block: 8px; gap: 6px 8px; }
  .header-actions { margin-left: auto; gap: 6px; }
  .header-actions__explore { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 10px; font-size: 12.5px; }
  .top-nav { display: flex; order: 3; flex: 1 1 100%; width: 100%; min-width: 0; margin-inline: 0; overflow-x: auto; gap: 4px; padding-top: 4px; border-top: 1px solid rgba(39, 103, 63, 0.14); scrollbar-width: none; }
  .top-nav::-webkit-scrollbar { display: none; }
  .top-nav__link { flex: 0 0 auto; min-height: 44px; padding-inline: 12px; font-size: 13px; white-space: nowrap; }
}

@media (max-width: 360px) {
  .wrap { width: calc(100% - 24px); }
  .top-nav__link { padding-inline: 10px; }
  .nav-link { padding-inline: 6px; font-size: 11px; }
  .primary-action { padding-inline: 9px; }
  .backup-actions { width: 100%; margin-left: 0; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: auto; }
  .metric-label { min-height: 0; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .record-topline { gap: 6px; }
  .share-dialog .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .share-dialog { padding-right: 12px; padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
