/* Lingyun workspace: shared chrome, type and density for the native business views. */
:root {
  /* Lingyun v2 tokens: the single source for colour, radius and focus. */
  --page: #f5f6f7;
  --surface: #fff;
  --surface-soft: #f1f3f5;
  --ink: #22262c;
  --muted: #565c66;
  --quiet: #6a707a;
  --icon: #7d848e;
  --line: #e1e4e8;
  --line-strong: #ccd1d8;
  --control-border: #878e98;
  --accent: #2563d9;
  --accent-strong: #2054b8;
  --accent-soft: #eaf0fc;
  --success: #21835b;
  --warning: #a86716;
  --danger: #c13e43;
  --sex-male: #6d8cbd;
  --sex-female: #ad6f86;
  --sex-unknown: #b2bac6;
  --graph-grid: #eef0f3;
  --graph-edge: #9aa5b3;
  --segmented-track: #e9ecf0;
  --disabled-bg: #e9ecf0;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;
  --sidebar: 236px;
  --topbar: 72px;
}
body.lingyun-ui { background: var(--page); color: var(--ink); font-size: 14px; }
/* v2 base: browser-default bold/small would reintroduce 700 and sub-12px text; zero specificity keeps every authored rule in charge. */
:where(.lingyun-ui) :where(strong, b, h1, h2, h3, h4, h5, h6, th) { font-weight: 600; }
:where(.lingyun-ui) :where(small) { font-size: 12px; }
.lingyun-ui .header-fact { display: grid; gap: 4px; text-align: right; }
.lingyun-ui .header-fact small { color: var(--muted); }
.lingyun-ui .header-fact strong { font-size: 14px; }
.lingyun-ui button { touch-action: manipulation; }
.lingyun-ui button:focus-visible, .lingyun-ui a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.lingyun-ui .glass { background: rgba(249,250,252,.8); -webkit-backdrop-filter: blur(28px) saturate(115%); backdrop-filter: blur(28px) saturate(115%); box-shadow: none; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 1000; padding: 12px 20px; background: white; color: var(--accent); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.lingyun-ui .topbar { left: var(--sidebar); right: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: env(safe-area-inset-top) 32px 0; border-bottom: 1px solid rgba(216,220,226,.8); }
.mobile-brand { display: none; }
.workspace-location { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; white-space: nowrap; }
.workspace-location > span { color: var(--muted); }
.workspace-location svg { width: 14px; height: 14px; color: var(--icon); }
.workspace-location strong { font-weight: 600; }
.lingyun-ui .top-actions { display: flex; align-items: center; gap: 10px; }
.workspace-search { min-height: 44px; min-width: 44px; width: 240px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.55); color: var(--muted); text-align: left; font-size: 12px; }
.workspace-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.lingyun-ui .top-actions .icon-button { background: transparent; border-color: transparent; width: 44px; height: 44px; }
.lingyun-ui .avatar-button { background: #e5e8ed; color: #525a66; border: 1px solid var(--line-strong); border-radius: 50%; width: 44px; height: 44px; font-size: 13px; }
.lingyun-ui .assistant-trigger { height: 44px; min-height: 44px; padding: 0 12px; color: var(--ink); background: rgba(255,255,255,.75); border: 1px solid var(--line-strong); border-radius: 8px; font-size: 12px; box-shadow: 0 1px 2px #20252d06; }
#eye-scan-quick { display: none; }
.lingyun-ui .side-nav { top: 0; bottom: 0; display: flex; flex-direction: column; gap: 0; padding: 20px 14px 12px; border: 0; border-right: 1px solid var(--line); background: rgba(232,235,241,.65); overflow-y: auto; scrollbar-width: thin; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 22px; text-align: left; border: 0; background: transparent; min-height: 66px; flex-shrink: 0; }
.sidebar-brand > span:last-child { display: grid; gap: 3px; }
.sidebar-brand strong { font-size: 23px; line-height: 1.2; font-weight: 600; }
.sidebar-brand small { color: var(--muted); font-size: 12px; }
.lingyun-ui .brand-mark { width: 36px; height: 40px; color: #3e4c66; background: transparent; box-shadow: none; border: 0; }
.lingyun-ui .brand-mark svg { width: 32px; height: 32px; stroke-width: 1.7; }
.lingyun-ui .loft-switcher { width: 100%; height: auto; min-height: 62px; display: grid; grid-template-columns: 20px minmax(0,1fr) 14px; gap: 10px; margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #ffffff85; }
.lingyun-ui .loft-switcher > svg { width: 18px; height: 18px; color: var(--muted); }
.lingyun-ui .loft-switcher > svg:last-child { width: 14px; }
.lingyun-ui .loft-switcher span { min-width: 0; justify-items: start; }
.lingyun-ui .loft-switcher small { font-size: 12px; }
.lingyun-ui .loft-switcher strong { margin-top: 3px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lingyun-ui .side-nav > nav { display: grid; gap: 3px; }
.nav-group-label { padding: 19px 12px 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
.lingyun-ui .nav-item { min-height: 44px; display: grid; grid-template-columns: 20px minmax(0,1fr) auto; align-items: center; justify-items: start; gap: 11px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.lingyun-ui .nav-item span, .lingyun-ui .nav-item b { display: block; }
.lingyun-ui .nav-item svg { width: 18px; height: 18px; stroke-width: 1.6; }
.lingyun-ui .nav-item b { font-size: 12px; color: var(--muted); font-weight: 500; background: transparent; }
.lingyun-ui .nav-item.is-active { color: var(--accent-strong); background: #fff; box-shadow: 0 1px 5px #2934450b, inset 0 0 0 1px var(--line); font-weight: 600; }
.lingyun-ui .nav-item:hover:not(.is-active) { background: #ffffff75; color: var(--ink); }
.lingyun-ui .nav-footer { margin-top: auto; padding-top: 24px; border-top: 0; }
.lingyun-ui .status-line { margin: 10px 12px 0; font-size: 12px; color: var(--muted); }
.lingyun-ui .status-line strong { display: block; font-weight: 400; }
.lingyun-ui #main-content { margin-left: var(--sidebar); padding: calc(var(--topbar) + env(safe-area-inset-top) + 30px) 32px 44px; }
.lingyun-ui .page { width: 100%; max-width: 1280px; margin-inline: auto; }
.lingyun-ui .page-header { align-items: center; gap: 16px; margin-bottom: 28px; }
.page-overline { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 500; }
.lingyun-ui .page > .page-header h1 { font-size: 26px; line-height: 1.3; font-weight: 600; }
.lingyun-ui .page-header p { margin-top: 8px; font-size: 12px; color: var(--muted); }
.lingyun-ui .page-actions { gap: 8px; }
.lingyun-ui .primary-button, .lingyun-ui .secondary-button, .lingyun-ui .danger-button { min-height: 44px; font-size: 12px; font-weight: 500; border-radius: 8px; padding: 9px 14px; }
.lingyun-ui .primary-button { background: var(--accent); box-shadow: inset 0 1px 0 #ffffff30, 0 2px 3px #20498415; }
.lingyun-ui .secondary-button { background: #ffffffa6; color: var(--ink); border-color: var(--line-strong); box-shadow: 0 1px 2px #20252d04; }
.lingyun-ui .text-button { min-height: 40px; font-size: 12px; font-weight: 500; gap: 5px; }
.lingyun-ui .text-button svg { width: 15px; height: 15px; }
.lingyun-ui .section-heading { margin-bottom: 18px; gap: 10px; }
.lingyun-ui .section-heading h2 { font-size: 16px; font-weight: 600; }
.lingyun-ui .section-heading h3 { font-size: 14px; }
.section-meta { font-size: 12px; color: var(--quiet); }
.loft-statistics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-block: 1px solid var(--line); margin: 0 0 30px; padding: 22px 0; }
.loft-stat { min-width: 0; display: grid; gap: 13px; padding: 0 24px; text-align: left; border: 0; border-right: 1px solid var(--line); background: transparent; border-radius: 0; }
.loft-stat:first-child { padding-left: 0; }
.loft-stat:last-child { padding-right: 0; border: 0; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.stat-label svg { width: 16px; height: 16px; color: var(--icon); }
.stat-number { display: flex; align-items: baseline; gap: 8px; }
.stat-number strong { font-size: 36px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-number small { color: var(--muted); font-size: 12px; }
.stat-detail { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 12px; }
.stat-detail svg { width: 14px; height: 14px; color: var(--icon); }
.home-quick { padding-bottom: 26px; }
.home-shortcuts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.home-shortcut { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 65px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; text-align: left; background: #ffffffb3; transition: transform 160ms ease, background-color 160ms ease; }
.home-shortcut strong { font-size: 13px; font-weight: 500; }
.home-shortcut:hover { background: #fff; transform: translateY(-2px); }
.shortcut-symbol { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 8px; }
.shortcut-symbol svg { width: 19px; height: 19px; stroke-width: 1.6; }
.tone-blue { color: #4778c7; background: #edf2fb; }
.tone-rose { color: #ba6b83; background: #f8edf1; }
.tone-amber { color: #ac8745; background: #f8f3e9; }
.tone-violet { color: #8271b8; background: #f1eef8; }
.tone-teal { color: #4b928e; background: #eaf5f3; }
.shortcut-chevron { width: 14px; height: 14px; margin-left: auto; color: var(--icon); }
.home-columns { display: grid; grid-template-columns: 1.15fr 1fr; gap: 36px; padding-top: 22px; }
.home-columns > section { min-width: 0; }
.home-history { padding-left: 30px; border-left: 1px solid var(--line); }
.home-section-divider { height: 1px; background: var(--line); margin: 24px 0 14px; }
.breeding-stages { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.breeding-stage { min-width: 0; display: grid; gap: 12px; text-align: left; border: 0; border-radius: 0; border-right: 1px solid var(--line); padding: 0 18px 0 0; background: transparent; }
.breeding-stage:last-child { border: 0; }
.stage-top { display: flex; align-items: center; justify-content: space-between; }
.stage-top svg { width: 19px; height: 19px; color: var(--icon); }
.stage-top small { color: var(--muted); font-size: 12px; }
.breeding-stage > span:nth-child(2) { font-size: 12px; color: var(--muted); }
.breeding-stage strong { display: flex; gap: 8px; align-items: baseline; font-size: 25px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; }
.breeding-stage strong small { color: var(--muted); font-size: 12px; font-weight: 400; }
.archive-distribution { display: flex; height: 7px; gap: 3px; overflow: hidden; border-radius: 4px; background: #e2e6ec; }
.archive-distribution span { background: var(--sex-male); }
.archive-distribution span:nth-child(2) { background: var(--sex-female); }
.archive-distribution span:nth-child(3) { background: var(--sex-unknown); }
.distribution-legend { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.distribution-legend span { display: flex; align-items: center; gap: 7px; }
.distribution-legend i { width: 6px; height: 6px; background: var(--sex-male); border-radius: 50%; }
.distribution-legend span:nth-child(2) i { background: var(--sex-female); }
.distribution-legend span:nth-child(3) i { background: var(--sex-unknown); }
.distribution-legend b { color: var(--ink); font-weight: 500; }
.ring-completeness { display: flex; align-items: center; gap: 9px; padding-top: 22px; font-size: 12px; color: var(--muted); }
.ring-completeness svg { width: 17px; height: 17px; }
.ring-completeness strong { margin-left: auto; color: var(--ink); font-size: 14px; }
.ring-completeness small { font-size: 12px; color: var(--muted); font-weight: 400; }
.home-event { display: flex; align-items: center; gap: 12px; min-height: 71px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.home-event:last-child { border-bottom: 0; }
.home-event-icon { width: 34px; height: 34px; display: grid; place-items: center; background: #e9edf2; border-radius: 50%; color: var(--icon); flex-shrink: 0; }
.home-event-icon svg { width: 16px; height: 16px; }
.home-event > div { display: grid; gap: 6px; min-width: 0; }
.home-event strong { font-size: 12px; font-weight: 500; }
.home-event time { color: var(--quiet); font-size: 12px; }
.event-saved { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.home-empty { min-height: 230px; display: grid; justify-items: center; align-content: center; gap: 12px; color: var(--muted); }
.home-empty > svg { width: 30px; height: 30px; color: var(--icon); }
.home-empty strong { color: var(--muted); font-size: 13px; font-weight: 500; }
.home-empty > span { display: none; }
.lingyun-ui .filter-toolbar { grid-template-columns: minmax(180px,1fr) auto auto; align-items: center; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.lingyun-ui .search-field { min-height: 42px; border-color: #d7dce3; background: #ffffffa3; border-radius: 8px; }
.lingyun-ui .search-field input { font-size: 13px; }
.lingyun-ui .segmented { min-height: 42px; border: 0; padding: 3px; gap: 2px; background: var(--segmented-track); border-radius: 8px; }
.lingyun-ui .segmented button { min-height: 36px; font-size: 12px; font-weight: 500; }
.lingyun-ui .segmented button.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 4px #26324312; }
.lingyun-ui .pigeon-grid { grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 12px; }
.lingyun-ui .archive-card { display: grid; grid-template-columns: 96px minmax(0,1fr); padding: 12px; gap: 14px; border: 1px solid var(--line); border-radius: 8px; min-height: 142px; background: #ffffffb3; }
.lingyun-ui .archive-photo { width: 96px; height: 116px; aspect-ratio: auto; border-radius: 4px; background: #eef0f3; }
.lingyun-ui .archive-photo > svg { color: var(--icon); width: 36px; height: 36px; }
.lingyun-ui .archive-photo img { object-fit: contain; transform: none; }
.lingyun-ui .archive-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px #343c4c09; }
.lingyun-ui .photo-badge { top: auto; bottom: 5px; left: 5px; right: 5px; justify-content: center; min-height: 20px; border-radius: 4px; background: rgba(255,255,255,.85); color: #656e7b; font-size: 12px; }
.lingyun-ui .archive-copy { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 0; }
.lingyun-ui .archive-copy > span:first-child { align-items: flex-start; gap: 5px; }
.lingyun-ui .archive-copy strong { font-size: 14px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.lingyun-ui .archive-copy small { font-size: 12px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.lingyun-ui .archive-meta { flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.lingyun-ui .archive-meta em { background: #f0f2f5; padding: 3px 6px; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.lingyun-ui .sex-badge { margin-top: 3px; font-size: 12px; }
.lingyun-ui .module-tabs { margin-bottom: 24px; gap: 6px; border-bottom-color: var(--line); }
.lingyun-ui .module-tabs button { font-size: 12px; font-weight: 500; }
.lingyun-ui .pairing-planner { background: transparent; border-inline: 0; border-radius: 0; padding: 0 0 24px; }
.lingyun-ui .pairing-evidence { background: #edf0f4; border-radius: 8px; padding: 12px 16px; }
.lingyun-ui .pair-card { box-shadow: none; border-color: var(--line); background: #ffffffb3; }
.lingyun-ui .pair-card:hover { box-shadow: 0 5px 16px #28334308; }
.lingyun-ui .nest-summary { background: transparent; border-radius: 0; border-bottom: 1px solid var(--line); padding: 0 0 20px; }
.lingyun-ui .nest-sheet { background: #ffffffb8; }
.lingyun-ui .nest-workbench > .empty-state { min-height: 160px; }
.lingyun-ui .showcase-photo { background: #e9ecef; }
.lingyun-ui .showcase-item { background: #ffffffb3; box-shadow: none; border-color: var(--line); }
.lingyun-ui .operations-command { background: transparent; }
.lingyun-ui .command-icon { background: #e8ecf1; color: var(--icon); }
.settings-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 36px; margin-top: 28px; }
.settings-list { border-top: 1px solid var(--line); }
.settings-list > button { width: 100%; min-height: 80px; display: grid; grid-template-columns: 22px minmax(0,1fr) 16px; align-items: center; gap: 14px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); text-align: left; background: transparent; }
.settings-list > button > svg { width: 20px; height: 20px; color: var(--icon); }
.settings-list > button > svg:last-child { width: 15px; height: 15px; color: var(--quiet); }
.settings-list strong, .settings-list small { display: block; }
.settings-list strong { font-size: 14px; font-weight: 500; }
.settings-list small { margin-top: 6px; color: var(--muted); font-size: 12px; }
.import-note { display: flex; gap: 14px; padding-block: 24px; color: var(--muted); }
.import-note > svg { width: 20px; height: 20px; color: var(--icon); }
.import-note strong, .import-note small { display: block; font-size: 12px; font-weight: 400; }
.import-note small { margin-top: 8px; color: var(--quiet); }
.lingyun-ui .form-field label, .lingyun-ui .field label { font-size: 12px; color: var(--muted); }
.lingyun-ui .form-field input, .lingyun-ui .form-field textarea, .lingyun-ui .field input, .lingyun-ui .field textarea, .lingyun-ui select { font-size: 14px; border-radius: 8px; }
.lingyun-ui .dialog-surface, .lingyun-ui .account-surface { background: rgba(250,251,252,.96); box-shadow: 0 24px 90px #1d293729; }
.lingyun-ui .dialog-surface > header { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.lingyun-ui .dialog-surface > header h2 { font-size: 20px; }
.lingyun-ui .more-grid { gap: 6px; }
.lingyun-ui .more-grid > button { min-height: 82px; background: #ffffffb0; border-color: var(--line); border-radius: 8px; }
.lingyun-ui .assistant-shell:not(.is-collapsed) { border-color: var(--line-strong); background: #fbfcfddd; box-shadow: 0 10px 36px #23314614; }
.lingyun-ui .assistant-head { background: #f5f7f9c9; }
.home-attention { padding-bottom: 26px; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.attention-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.attention-item { min-height: 64px; display: grid; grid-template-columns: 36px minmax(0, 1fr) 16px; align-items: center; gap: 12px; padding: 10px 14px; text-align: left; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.attention-item strong { display: block; font-size: 14px; font-weight: 600; }
.attention-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.attention-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius); color: var(--accent-strong); background: var(--accent-soft); }
.attention-icon svg { width: 18px; height: 18px; }
.attention-chevron { width: 16px; height: 16px; color: var(--icon); }
.attention-item.is-warning .attention-icon { color: var(--warning); background: #fdf3e6; }
.attention-item.is-warning small { color: var(--warning); }
.attention-item:hover { border-color: var(--line-strong); }
.attention-clear { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 14px; }
.attention-clear svg { width: 18px; height: 18px; color: var(--success); }
@media (max-width: 820px) { .attention-list { grid-template-columns: 1fr; gap: 8px; } .home-attention { padding-bottom: 20px; margin-bottom: 20px; } }
.lingyun-ui .empty-state .empty-action { margin-top: 16px; }
.lingyun-ui .empty-state .empty-action svg { width: 17px; height: 17px; margin: 0; color: inherit; }
.filter-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lingyun-ui .filter-group > .segmented { order: 0; flex: 0 1 auto; }
.lingyun-ui .filter-group > .segmented button { white-space: nowrap; }
.lingyun-ui .filter-group > .filter-toggle { order: 1; flex: none; }
.lingyun-ui .filter-toggle { min-height: 42px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font-size: 12px; font-weight: 500; white-space: nowrap; }
.lingyun-ui .filter-toggle svg { width: 16px; height: 16px; }
.lingyun-ui .filter-toggle[aria-pressed="true"] { color: var(--accent-strong); border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 960px) { .lingyun-ui .filter-toolbar > .filter-group { grid-column: 1; order: 0; } }
/* v2: 添加照片 has a single home in the detail header; keep it reachable on phones (edit stays in the header on desktop). */
@media (max-width: 820px) {
  .lingyun-ui .detail-header .page-actions [data-detail-action="upload"] { display: inline-flex; width: auto; padding: 0 11px; white-space: nowrap; }
  .lingyun-ui .detail-header .page-actions [data-detail-action="upload"] span { display: inline; }
}

/* ---------- v3 tables: column templates per ledger, numbers right-aligned, rows read as actionable ---------- */
.lingyun-ui .record-table { --cols: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); border-top: 0; }
.lingyun-ui .record-table.compact-table { --cols: minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(72px, .8fr) minmax(56px, .6fr); }
.lingyun-ui .record-table.results-ledger { --cols: minmax(0, 1.5fr) minmax(0, 1.8fr) minmax(76px, .9fr) minmax(84px, .9fr); }
.lingyun-ui .record-table.reminders-table { --cols: minmax(0, 2fr) minmax(84px, 1fr) minmax(92px, 1fr) minmax(0, 1.6fr); }
.lingyun-ui .record-table.release-table { --cols: minmax(0, 2fr) minmax(0, 1fr) minmax(64px, .8fr) minmax(0, 1.4fr); }
.lingyun-ui .record-table.health-ledger { --cols: minmax(0, 1.5fr) minmax(84px, 1fr) minmax(0, 1.5fr) minmax(0, 1.5fr); }
.lingyun-ui .record-table.detail-results { --cols: minmax(0, 2fr) minmax(76px, 1fr) minmax(84px, 1fr) minmax(84px, 1fr); }
.lingyun-ui .record-table-head, .lingyun-ui .record-table-row { min-width: 0; grid-template-columns: var(--cols); gap: 16px; padding-inline: 12px 36px; }
.lingyun-ui .record-table-head { position: sticky; top: 0; z-index: 1; min-height: 40px; color: var(--muted); font-size: 12px; font-weight: 500; background: var(--page); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); }
.lingyun-ui .record-table-row { position: relative; min-height: 60px; padding-block: 10px; color: var(--ink); font-size: 14px; line-height: 1.5; border-bottom: 1px solid var(--line); border-radius: 0; }
.lingyun-ui .record-table-row > span { min-width: 0; overflow-wrap: anywhere; }
.lingyun-ui .record-table-row strong { font-size: 14px; font-weight: 600; }
.lingyun-ui .record-table-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.lingyun-ui .record-table .cell-number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lingyun-ui .record-table-row .cell-number small { display: inline; margin: 0; }
.lingyun-ui .cell-empty { color: var(--quiet); }
.lingyun-ui button.record-table-row { cursor: pointer; }
.lingyun-ui button.record-table-row::after { content: ""; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--icon); border-bottom: 1.5px solid var(--icon); transform: translateY(-50%) rotate(-45deg); }
@media (hover: hover) and (pointer: fine) { .lingyun-ui button.record-table-row:hover { background: rgba(255, 255, 255, 0.75); } }
.lingyun-ui button.record-table-row:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.lingyun-ui .status-badge { min-height: 24px; padding: 0 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; white-space: nowrap; }
.lingyun-ui .status-badge.is-warning { color: var(--warning); background: #fdf3e6; }
.lingyun-ui .status-badge.is-done { color: var(--success); background: #e8f4ee; }
.lingyun-ui .status-badge.is-muted { color: var(--muted); background: var(--surface-soft); }
.lingyun-ui .section-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.lingyun-ui .module-table-section > .section-heading { align-items: center; }
@media (max-width: 820px) {
  .lingyun-ui .record-table { overflow: visible; }
  .lingyun-ui .record-table-head { display: none; }
  .lingyun-ui .record-table-row { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding: 14px 32px 14px 0; font-size: 14px; }
  .lingyun-ui .record-table-row > span:first-child { grid-column: 1 / -1; }
  .lingyun-ui .record-table-row > span:not(:first-child)::before { display: block; margin-bottom: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
  .lingyun-ui .record-table .cell-number { text-align: left; }
  .lingyun-ui button.record-table-row::after { right: 6px; top: 24px; transform: rotate(-45deg); }
  .lingyun-ui .record-table.detail-results .record-table-row > span:nth-child(2)::before { content: "名次 / 参赛"; }
  .lingyun-ui .record-table.detail-results .record-table-row > span:nth-child(3)::before { content: "分速"; }
  .lingyun-ui .record-table.detail-results .record-table-row > span:nth-child(4)::before { content: "日期"; }
  .lingyun-ui .record-table.compact-table .record-table-row > span:nth-child(2)::before { content: "放飞地"; }
  .lingyun-ui .record-table.compact-table .record-table-row > span:nth-child(3)::before { content: "距离"; }
  .lingyun-ui .record-table.compact-table .record-table-row > span:nth-child(4)::before { content: "成绩"; }
  .lingyun-ui .record-table.results-ledger .record-table-row > span:nth-child(2)::before { content: "赛事"; }
  .lingyun-ui .record-table.results-ledger .record-table-row > span:nth-child(3)::before { content: "名次 / 参赛"; }
  .lingyun-ui .record-table.results-ledger .record-table-row > span:nth-child(4)::before { content: "分速"; }
  .lingyun-ui .record-table.reminders-table .record-table-row > span:nth-child(2)::before { content: "时间"; }
  .lingyun-ui .record-table.reminders-table .record-table-row > span:nth-child(3)::before { content: "状态"; }
  .lingyun-ui .record-table.reminders-table .record-table-row > span:nth-child(4)::before { content: "备注"; }
  .lingyun-ui .record-table.release-table .record-table-row > span:nth-child(2)::before { content: "省份"; }
  .lingyun-ui .record-table.release-table .record-table-row > span:nth-child(3)::before { content: "代码"; }
  .lingyun-ui .record-table.release-table .record-table-row > span:nth-child(4)::before { content: "坐标"; }
  .lingyun-ui .record-table.health-ledger .record-table-row > span:nth-child(2)::before { content: "观察时间"; }
  .lingyun-ui .record-table.health-ledger .record-table-row > span:nth-child(3)::before { content: "症状"; }
  .lingyun-ui .record-table.health-ledger .record-table-row > span:nth-child(4)::before { content: "处理"; }
  .lingyun-ui .module-table-section > .section-heading { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .lingyun-ui .module-table-section > .section-heading > .primary-button, .lingyun-ui .module-table-section > .section-heading .section-actions { align-self: center; margin: 0 0 0 auto; }
  .lingyun-ui .module-table-section > .section-heading .section-actions .text-button span { display: none; }
}
/* ---------- v3 list rows and tab strip ---------- */
.lingyun-ui .data-row .row-meta { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.lingyun-ui button.data-row { position: relative; padding-right: 26px; color: inherit; cursor: pointer; }
.lingyun-ui button.data-row::after { content: ""; position: absolute; right: 6px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--icon); border-bottom: 1.5px solid var(--icon); transform: translateY(-50%) rotate(-45deg); }
@media (hover: hover) and (pointer: fine) { .lingyun-ui button.data-row:hover .row-title strong { color: var(--accent-strong); } }
.lingyun-ui button.data-row:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: var(--radius-sm); }
.lingyun-ui .module-tabs[data-fade-end="true"] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.lingyun-ui .module-tabs[data-fade-start="true"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.lingyun-ui .module-tabs[data-fade-start="true"][data-fade-end="true"] { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }

.lingyun-ui .assistant-voice-hint { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-soft); color: var(--muted); font-size: 12px; line-height: 1.6; }
.lingyun-ui .assistant-voice-hint svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; color: var(--accent); }

/* ---------- v3 forms: one field style everywhere ---------- */
.lingyun-ui .field > span, .lingyun-ui .field > label, .lingyun-ui .form-field > label { color: var(--ink); font-size: 12px; font-weight: 500; }
.lingyun-ui .field input, .lingyun-ui .field select, .lingyun-ui .field textarea,
.lingyun-ui .form-field input, .lingyun-ui .form-field select, .lingyun-ui .form-field textarea { min-height: 44px; padding: 9px 12px; border-radius: var(--radius); background: #fff; font-size: 14px; }
.lingyun-ui .field input::placeholder, .lingyun-ui .form-field input::placeholder, .lingyun-ui textarea::placeholder { color: var(--quiet); }
.lingyun-ui .field input:focus-visible, .lingyun-ui .field select:focus-visible, .lingyun-ui .field textarea:focus-visible,
.lingyun-ui .form-field input:focus-visible, .lingyun-ui .form-field select:focus-visible, .lingyun-ui .form-field textarea:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px #2563d92e; }
.lingyun-ui .speed-calculator { max-width: 760px; gap: 20px; }
.lingyun-ui .speed-calculator p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.lingyun-ui .calculator-form { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #ffffffb3; }
.lingyun-ui .calculator-form .primary-button { min-height: 44px; }
.lingyun-ui .speed-result { display: flex; align-items: baseline; gap: 8px; padding: 0 2px; }
.lingyun-ui .speed-result small { color: var(--muted); font-size: 12px; margin-right: 6px; }
.lingyun-ui .speed-result strong { font-size: 29px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lingyun-ui .speed-result span { color: var(--muted); font-size: 13px; }
@media (max-width: 820px) {
  .lingyun-ui .calculator-form { grid-template-columns: 1fr 1fr; padding: 14px; }
  .lingyun-ui .calculator-form .calc-distance, .lingyun-ui .calculator-form .primary-button { grid-column: 1 / -1; }
}

/* ---------- v3 dialogs: key/value records read as a ledger ---------- */
.lingyun-ui .operation-fields { gap: 0; border-top: 1px solid var(--line); }
.lingyun-ui .operation-fields > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lingyun-ui .operation-fields dt { margin: 0; color: var(--muted); font-size: 12px; }
.lingyun-ui .operation-fields dd { font-size: 14px; }
.lingyun-ui .operation-detail > .secondary-button { justify-self: start; }
.lingyun-ui #dialog-kicker { color: var(--muted); font-weight: 500; }

/* ---------- v4 pedigree: per-card expand toggles, compact phone cards ---------- */
.lingyun-ui .kinship-node-copy small { font-size: 12px; }
.lingyun-ui .kinship-node-copy strong { margin: 3px 0 2px; font-size: 14px; font-weight: 600; }
.lingyun-ui .kinship-node-copy em { font-size: 12px; }
.lingyun-ui .kinship-node.is-exiting { pointer-events: none; z-index: 1; }
.lingyun-ui .pedigree-toggle { position: absolute; z-index: 5; width: 44px; height: 44px; min-height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; touch-action: manipulation; }
.lingyun-ui .pedigree-toggle > span { width: 24px; height: 24px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--muted); font-size: 17px; font-weight: 600; line-height: 1; box-shadow: 0 1px 3px #23314614; transition: background-color var(--motion-quick, 140ms), color var(--motion-quick, 140ms), border-color var(--motion-quick, 140ms); }
.lingyun-ui .pedigree-toggle.is-expand > span { border-color: var(--accent); color: var(--accent-strong); }
.lingyun-ui .pedigree-toggle:focus-visible { outline: 0; }
.lingyun-ui .pedigree-toggle:focus-visible > span { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .lingyun-ui .pedigree-toggle:hover > span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
}
.lingyun-ui .pedigree-toggle:active > span { background: var(--accent-soft); }
.lingyun-ui .pedigree-toggle.is-loading > span { color: transparent; border-color: var(--accent-soft); border-top-color: var(--accent); animation: rel-spin .8s linear infinite; }
.lingyun-ui .kinship-canvas.is-compact .kinship-node { grid-template-columns: 40px minmax(0, 1fr); gap: 8px; padding: 6px 8px 6px 6px; }
.lingyun-ui .kinship-canvas.is-compact .kinship-node-media { width: 40px; height: 62px; }
.lingyun-ui .kinship-canvas.is-compact .kinship-node-copy strong { font-size: 13px; }
@media (max-width: 600px) {
  .lingyun-ui .pedigree-subtoolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; padding: 8px 12px; }
  .lingyun-ui .pedigree-subtoolbar .pedigree-breadcrumb { grid-column: 1 / -1; }
  .lingyun-ui .pedigree-subtoolbar .pedigree-breadcrumb.is-single { display: none; }
  .lingyun-ui .pedigree-subtoolbar .segmented button { min-width: 52px; }
}
@media (prefers-reduced-motion: reduce) { .lingyun-ui .pedigree-toggle.is-loading > span { animation: none; } }

/* ---------- v5: docked assistant on 1024–1279px keeps the page usable ---------- */
@media (min-width: 1024px) and (max-width: 1279px) {
  body.lingyun-ui.assistant-desktop-docked { --sidebar: 72px; --assistant-dock-width: 380px; }
  body.lingyun-ui.assistant-desktop-docked .topbar { right: calc(12px + var(--assistant-dock-width) + 16px) !important; padding-inline: 20px; }
  body.lingyun-ui.assistant-desktop-docked #main-content { padding-left: 24px; padding-right: calc(22px + var(--assistant-dock-width) + 12px) !important; }
  body.lingyun-ui.assistant-desktop-docked .side-nav { padding: 16px 12px 12px; align-items: center; }
  body.lingyun-ui.assistant-desktop-docked .sidebar-brand { justify-content: center; padding: 0 0 16px; min-height: 52px; }
  body.lingyun-ui.assistant-desktop-docked .sidebar-brand > span:last-child,
  body.lingyun-ui.assistant-desktop-docked .loft-switcher > span,
  body.lingyun-ui.assistant-desktop-docked .loft-switcher > svg:last-child,
  body.lingyun-ui.assistant-desktop-docked .nav-item span,
  body.lingyun-ui.assistant-desktop-docked .nav-item b { display: none; }
  body.lingyun-ui.assistant-desktop-docked .loft-switcher { width: 44px; min-height: 44px; grid-template-columns: 1fr; justify-items: center; padding: 0; margin-bottom: 8px; }
  body.lingyun-ui.assistant-desktop-docked .side-nav > nav { width: 44px; }
  body.lingyun-ui.assistant-desktop-docked .nav-group-label { height: 1px; margin: 10px 6px; padding: 0; overflow: hidden; color: transparent; background: var(--line-strong); }
  body.lingyun-ui.assistant-desktop-docked .nav-item { width: 44px; grid-template-columns: 1fr; justify-items: center; padding: 0; }
}

/* v5: assistant drafts read as a short ledger, never raw JSON. */
body.lingyun-ui .assistant-draft-fields {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px;
  margin: 8px 0 12px;
  font-size: 13px;
  line-height: 1.5;
}
body.lingyun-ui .assistant-draft-fields dt { color: var(--muted); }
body.lingyun-ui .assistant-draft-fields dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
body.lingyun-ui .assistant-draft-empty { margin: 6px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.55; }
body.lingyun-ui .assistant-draft-summary .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* v2: controls must be identifiable (3:1 boundary) and disabled actions must not look active. */
.lingyun-ui input:not([type=checkbox]):not([type=radio]):not([type=range]), .lingyun-ui textarea, .lingyun-ui select { border-color: var(--control-border); }
.lingyun-ui .search-field, .lingyun-ui .loft-picker-input { border-color: var(--control-border); background: var(--surface); }
.lingyun-ui .search-field input, .lingyun-ui .loft-picker-input input { border: 0; }
.lingyun-ui .primary-button:disabled, .lingyun-ui .secondary-button:disabled, .lingyun-ui .danger-button:disabled { opacity: 1; color: var(--muted); background: var(--disabled-bg); border-color: var(--disabled-bg); box-shadow: none; }
.lingyun-ui .action-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
@media (min-width: 821px) and (max-width: 1200px) {
  :root { --sidebar: 204px; }
  .lingyun-ui .topbar { padding-inline: 24px; }
  .lingyun-ui #main-content { padding-inline: 24px; }
  .workspace-search { width: 40px; justify-content: center; padding: 0; }
  .workspace-search span { display: none; }
  .workspace-location > span, .workspace-location > svg { display: none; }
  .lingyun-ui .side-nav { padding-inline: 10px; }
  .sidebar-brand strong { font-size: 21px; }
  .home-shortcut { padding: 10px; gap: 8px; }
  .shortcut-chevron { display: none; }
  .home-shortcut strong { font-size: 12px; }
  .home-columns { gap: 24px; }
  .home-history { padding-left: 24px; }
  .loft-stat { padding-inline: 16px; }
  .stat-label { font-size: 12px; gap: 5px; }
  .stat-label svg { display: none; }
}
@media (min-width: 821px) and (max-width: 960px) {
  .home-shortcuts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .home-columns { grid-template-columns: 1fr; }
  .home-history { padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .lingyun-ui .filter-toolbar { grid-template-columns: 1fr auto; }
  .lingyun-ui .filter-toolbar > .search-field { grid-column: 1 / -1; }
  .lingyun-ui .filter-toolbar > .segmented { grid-column: 1; order: 0; }
}
@media (max-width: 820px) {
  :root { --sidebar: 0px; --topbar: 64px; }
  .lingyun-ui .topbar { left: 0; padding-inline: 16px; gap: 10px; }
  .lingyun-ui .side-nav, .workspace-location { display: none; }
  .lingyun-ui .mobile-brand { display: flex; justify-content: flex-start; gap: 6px; padding: 0; height: 52px; min-width: 0; }
  .lingyun-ui .brand-copy { display: grid; gap: 2px; }
  .lingyun-ui .brand-copy strong { font-size: 19px; font-weight: 600; }
  .lingyun-ui .brand-copy small { display: block; max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
  .lingyun-ui .brand-mark { width: 28px; height: 36px; }
  .lingyun-ui .brand-mark svg { width: 25px; height: 25px; }
  .lingyun-ui #global-search { display: flex; width: 44px; height: 44px; padding: 0; justify-content: center; background: transparent; border: 0; }
  .workspace-search span, #notification-button, #assistant-trigger { display: none; }
  .lingyun-ui .top-actions { gap: 6px; }
  .lingyun-ui #main-content { margin-left: 0; padding: calc(var(--topbar) + env(safe-area-inset-top) + 22px) 18px calc(88px + env(safe-area-inset-bottom)); }
  .lingyun-ui .page-header { margin-bottom: 22px; align-items: center; gap: 10px; }
  .page-overline { font-size: 12px; margin-bottom: 5px; }
  .lingyun-ui .page > .page-header h1 { font-size: 23px; }
  .lingyun-ui .home-heading p { display: block; margin-top: 6px; font-size: 12px; }
  .lingyun-ui .page-actions { flex-wrap: wrap; justify-content: flex-end; }
  .lingyun-ui .page-actions .primary-button { min-height: 44px; padding: 8px 11px; font-size: 12px; }
  .lingyun-ui .page-actions .secondary-button { min-width: 44px; width: 44px; padding: 0; }
  .lingyun-ui .page-actions .secondary-button span { display: none; }
  .lingyun-ui .bottom-nav { left: 0; right: 0; bottom: 0; height: calc(66px + env(safe-area-inset-bottom)); padding: 5px 10px calc(5px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line-strong); border-radius: 0; background: #f8fafcdc; box-shadow: 0 -4px 20px #2d374d05; }
  .lingyun-ui .mobile-nav-item { min-height: 54px; gap: 5px; border-radius: 8px; }
  .lingyun-ui .mobile-nav-item span, .lingyun-ui .mobile-nav-item small { font-size: 12px; }
  .lingyun-ui .mobile-nav-item.is-active { background: transparent; color: var(--accent-strong); }
  .lingyun-ui .mobile-nav-item.is-active svg { stroke-width: 2.4; }
  .lingyun-ui .mobile-nav-item.agent-action > span { width: 30px; height: 22px; margin: 0; border: 0; border-radius: 4px; box-shadow: none; background: transparent; color: var(--accent); }
  .lingyun-ui .mobile-nav-item.agent-action small { margin: 0; }
  .lingyun-ui .mobile-nav-item.agent-action.is-holding > span, .lingyun-ui .mobile-nav-item.agent-action.is-recording > span { color: #b33f55; background: #fae9ed; box-shadow: none; }
  .loft-statistics { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0; margin-bottom: 24px; }
  .loft-stat { padding: 18px 0; gap: 10px; border-right: 0; }
  .loft-stat:nth-child(even) { padding-left: 20px; }
  .loft-stat:nth-child(odd) { padding-right: 20px; }
  .loft-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .stat-label { font-size: 12px; }
  .stat-number strong { font-size: 29px; }
  .stat-detail { font-size: 12px; }
  .stat-detail svg { width: 12px; height: 12px; }
  .home-shortcuts { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px 8px; }
  .home-shortcut { flex-direction: column; justify-content: center; padding: 0; min-height: 70px; gap: 8px; border: 0; border-radius: 0; background: transparent; }
  .home-shortcut:hover { background: transparent; }
  .home-shortcut strong { font-size: 12px; font-weight: 500; white-space: nowrap; }
  .shortcut-symbol { width: 40px; height: 40px; border-radius: 8px; border: 1px solid #ffffffb8; box-shadow: 0 1px 3px #29374a05; }
  .shortcut-symbol svg { width: 21px; height: 21px; }
  .shortcut-chevron { display: none; }
  .home-quick { padding-bottom: 22px; }
  .home-columns { grid-template-columns: 1fr; gap: 26px; padding-top: 16px; }
  .home-history { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .lingyun-ui .section-heading { margin-bottom: 16px; }
  .lingyun-ui .section-heading h2 { font-size: 15px; }
  .section-meta { font-size: 12px; }
  .breeding-stages { gap: 16px; }
  .breeding-stage { gap: 10px; }
  .breeding-stage strong { font-size: 23px; }
  .lingyun-ui .pigeon-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .lingyun-ui .archive-card { grid-template-columns: 84px minmax(0,1fr); gap: 14px; padding: 10px; min-height: 120px; }
  .lingyun-ui .archive-photo { width: 84px; height: 100px; border-radius: 4px; background: #eaedf1; }
  .lingyun-ui .archive-copy { padding: 0; justify-content: center; }
  .lingyun-ui .archive-copy strong { font-size: 16px; }
  .lingyun-ui .archive-copy small { font-size: 12px; }
  .lingyun-ui .archive-meta { margin-top: 8px; }
  .lingyun-ui .archive-meta em { font-size: 12px; }
  .lingyun-ui .photo-badge { right: auto; padding-inline: 6px; bottom: 6px; left: 6px; }
  .lingyun-ui .filter-toolbar { grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding-bottom: 14px; margin-bottom: 16px; }
  .lingyun-ui .filter-toolbar > .search-field { grid-column: 1 / -1; }
  .lingyun-ui .filter-toolbar > .segmented { grid-column: 1; order: 0; }
  .lingyun-ui .segmented button { font-size: 12px; padding-inline: 10px; }
  .lingyun-ui .toolbar-count { font-size: 12px; }
  .lingyun-ui input:not([type=checkbox]):not([type=radio]), .lingyun-ui textarea, .lingyun-ui select, .lingyun-ui .search-field input { font-size: 16px; }
  .lingyun-ui .module-tabs { margin-bottom: 20px; }
  .settings-columns { grid-template-columns: 1fr; gap: 28px; }
  .lingyun-ui .more-surface { padding: 18px 16px calc(22px + env(safe-area-inset-bottom)); background: #f5f7faed; }
  .lingyun-ui .more-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
  .lingyun-ui .more-grid > button { font-size: 12px; gap: 10px; }
  .lingyun-ui .more-grid > button svg { width: 22px; height: 22px; stroke-width: 1.6; color: var(--icon); }
  body.lingyun-ui.pedigree-fullscreen-active #main-content,
  body.lingyun-ui.kinship-view-active #main-content { padding: 0; margin: 0; }
  body.lingyun-ui.pedigree-fullscreen-active .topbar,
  body.lingyun-ui.pedigree-fullscreen-active .bottom-nav,
  body.lingyun-ui.kinship-view-active .topbar,
  body.lingyun-ui.kinship-view-active .bottom-nav,
  body.lingyun-ui.assistant-mobile-open .bottom-nav { display: none; }
}
@media (min-width: 600px) and (max-width: 820px) {
  .lingyun-ui .pigeon-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .loft-statistics { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .loft-stat:nth-child(n) { border: 0; padding: 20px 12px; }
  .loft-stat:first-child { padding-left: 0; }
}
@media (min-width: 1024px) {
  body.lingyun-ui.assistant-desktop-docked .workspace-location { display: none; }
  body.lingyun-ui.assistant-desktop-docked .workspace-search { width: 40px; padding: 0; justify-content: center; }
  body.lingyun-ui.assistant-desktop-docked .workspace-search span { display: none; }
  body.lingyun-ui.assistant-desktop-docked .home-shortcuts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.lingyun-ui.assistant-desktop-docked .home-columns { grid-template-columns: 1fr; }
  body.lingyun-ui.assistant-desktop-docked .home-history { padding-left: 0; border-left: 0; }
  body.lingyun-ui.assistant-desktop-docked .loft-stat { padding-inline: 8px; }
  body.lingyun-ui.assistant-desktop-docked .stat-label svg { display: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .lingyun-ui .glass { background: #f5f6f8; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lingyun-ui *, .lingyun-ui *::before, .lingyun-ui *::after { transition: none !important; animation: none !important; }
}

/* ---------- v5: one type scale for the whole app ----------
   Census before this block (8 desktop pages): 75% of visible text was 12px,
   page titles used five sizes (20–28px) and CJK badges rendered in synthetic
   italics. Roles below: caption 12 · meta 13 · body 14 · title 15 ·
   section 17 · page 24 (20 on phones). */
body.lingyun-ui {
  --fs-caption: 12px;
  --fs-meta: 13px;
  --fs-body: 14px;
  --fs-title: 15px;
  --fs-section: 17px;
  --fs-page: clamp(20px, 1.2vw + 12px, 24px);
  line-height: 1.55;
}
/* Chinese has no true italic; the browser slant made badges look broken. */
body.lingyun-ui em,
body.lingyun-ui i:not([data-lucide]):not(svg) { font-style: normal; }

/* Page and section titles: one size each. */
body.lingyun-ui #main-content h1 { font-size: var(--fs-page); font-weight: 600; line-height: 1.3; letter-spacing: 0; }
body.lingyun-ui #main-content .section-heading h2,
body.lingyun-ui #main-content .module-table-section h2 { font-size: var(--fs-section); font-weight: 600; line-height: 1.4; }

/* Controls read at body size. */
body.lingyun-ui :is(.primary-button, .secondary-button, .danger-button, .filter-toggle, .text-button) { font-size: var(--fs-body); }
body.lingyun-ui :is(.primary-button, .secondary-button, .danger-button, .filter-toggle) span { font-size: inherit; }
body.lingyun-ui #main-content .segmented button { font-size: var(--fs-meta); }

/* Record titles and secondary lines. */
body.lingyun-ui :is(.archive-copy strong, .row-title strong, .home-shortcut strong, .diary-copy strong) { font-size: var(--fs-title); font-weight: 600; }
body.lingyun-ui :is(
  .archive-copy small, .row-title small, .diary-copy span, .diary-full-date, .diary-date small,
  .row-meta .cell-number, .stat-label, .stat-detail, .section-meta, .toolbar-count,
  .stage-top small, .breeding-stage span, .distribution-legend span, .home-event span,
  .pedigree-title small, .header-fact small, .member small, .nest-summary span, .empty-state p
) { font-size: var(--fs-meta); line-height: 1.55; }

/* Badges stay caption-sized but upright, tinted and legible. */
body.lingyun-ui :is(.status-badge, .photo-badge, .archive-meta em) { font-size: var(--fs-caption); font-weight: 500; }
body.lingyun-ui .archive-meta em { color: var(--ink); border-radius: var(--radius-sm); }
body.lingyun-ui .archive-meta em.is-missing { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
body.lingyun-ui .sex-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; margin-top: 1px;
  border-radius: var(--radius-full); font-size: var(--fs-caption); font-weight: 600;
  color: var(--sex-unknown); background: color-mix(in srgb, var(--sex-unknown) 14%, transparent);
}
body.lingyun-ui .sex-badge[data-sex="male"] { color: #3f63a0; background: color-mix(in srgb, var(--sex-male) 16%, transparent); }
body.lingyun-ui .sex-badge[data-sex="female"] { color: #8c4a63; background: color-mix(in srgb, var(--sex-female) 16%, transparent); }

/* KPI numbers: two sizes, tabular. */
body.lingyun-ui .stat-number strong { font-size: 32px; font-variant-numeric: tabular-nums; }
body.lingyun-ui .breeding-stage strong { font-size: 24px; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  body.lingyun-ui .archive-copy strong { font-size: 16px; }
  body.lingyun-ui .stat-number strong { font-size: 28px; }
}

/* v5m: saved recipes first in the assistant welcome; elapsed time while the model works. */
.assistant-recipe-shortcuts { margin: 0 0 14px; }
.assistant-recipe-shortcuts h4 { margin: 2px 0 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.assistant-recipe-shortcut > span { display: grid; gap: 2px; }
.assistant-recipe-shortcut strong { font-size: 14px; font-weight: 600; }
.assistant-recipe-shortcut small { font-size: 12px; color: var(--muted); }
.assistant-activity-elapsed { margin-top: 2px; font-size: 12px; color: var(--quiet, var(--muted)); }
.assistant-activity-elapsed:empty { display: none; }
#assistant-cards .assistant-query-card > .assistant-card-command { margin: 10px 14px 14px; }
.assistant-query-record small:empty { display: none; }
.assistant-recipe-shortcut > span { min-width: 0; overflow: hidden; }
.assistant-recipe-shortcut strong, .assistant-recipe-shortcut small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
