/* Colony — one stylesheet. Tokens first, then shell, components, views, print. */
:root {
  --bg: #f6f5f0; --surface: #ffffff; --surface-2: #f1efe8; --surface-3: #e9e6dc; --line: #e2dfd4; --line-2: #d3cfc2;
  --text: #1c1d19; --text-2: #5c5f55; --text-3: #85887c;
  --accent: #3e7d3a; --accent-strong: #2f662c; --accent-soft: #e2eed9; --accent-soft-2: #cfe3c1; --on-accent: #ffffff;
  --warn: #9a5f00; --warn-soft: #fbeccd; --bad: #b3261e; --bad-soft: #fbe2de; --ok: #2e6f31; --ok-soft: #e0efdc; --info: #2e5d8c; --info-soft: #e0eaf5;
  --male: #3a6aa8; --male-soft: #e1eaf6; --female: #a8406f; --female-soft: #f6e2ea;
  --t-breeding: #c0567f; --t-holding: #3e7d3a; --t-weaning: #c98a14; --t-quarantine: #6a5bb0;
  --shadow: 0 1px 2px rgba(30, 30, 20, .06), 0 2px 8px rgba(30, 30, 20, .05);
  --shadow-lg: 0 8px 32px rgba(20, 20, 10, .18);
  --r: 14px; --r-sm: 9px;
  --font: "Google Sans", "Google Sans Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Google Sans Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11130f; --surface: #191c16; --surface-2: #20241c; --surface-3: #282d23; --line: #2d3228; --line-2: #3a4034;
    --text: #e7e9e0; --text-2: #a8ad9e; --text-3: #7d8274;
    --accent: #94cf7d; --accent-strong: #b4e3a0; --accent-soft: #233420; --accent-soft-2: #2e4629; --on-accent: #0f200b;
    --warn: #f0b858; --warn-soft: #3a2d12; --bad: #f2897e; --bad-soft: #3e1e1a; --ok: #8fd08f; --ok-soft: #1d3320; --info: #93bde9; --info-soft: #1a2a3c;
    --male: #8db6ea; --male-soft: #1c2a3d; --female: #ec97bd; --female-soft: #3a1f2c;
    --t-breeding: #e27ba3; --t-holding: #86c16f; --t-weaning: #e6ad3e; --t-quarantine: #a598e8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 10px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 .6em; }
p:last-child { margin-bottom: 0; }
[hidden] { display: none !important; }
.ms { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-feature-settings: "liga"; font-feature-settings: "liga"; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; flex: none; user-select: none; }
.mono { font-family: var(--mono); font-size: .93em; letter-spacing: -.01em; }
.dim { color: var(--text-2); }
.small { font-size: .85em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.link { color: var(--accent-strong); text-decoration: none; }
.link:hover, a.mono:hover { text-decoration: underline; }
a.mono { color: var(--accent-strong); text-decoration: none; font-weight: 500; white-space: nowrap; }
.tbl .mono { white-space: nowrap; }
.tbl td.geno .mono { white-space: normal; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--surface) 251px, var(--line) 251px, var(--line) 252px, transparent 252px); }
.nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 4px 8px 16px; }
.brand-t { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-t b { font-size: 19px; letter-spacing: -.02em; }
.brand-t small { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 999px; text-decoration: none; color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.nav-a:hover { background: var(--surface-2); color: var(--text); }
.nav-a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
.nav-a[aria-current="page"] .ms { font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }
.nav-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px; color: var(--text-2); font-size: 13.5px; border-top: 1px solid var(--line); text-decoration: none; border-radius: 0 0 10px 10px; }
.nav-foot:hover { color: var(--accent-strong); }
.nav-foot span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.menu-btn, .top-brand, .find-btn { display: none !important; }
.top-brand { align-items: center; gap: 8px; text-decoration: none; font-size: 17px; }
.find { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 12px; height: 40px; }
.find:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.find .ms { color: var(--text-3); }
.find input { flex: 1; border: 0; background: none; outline: none; min-width: 0; height: 100%; }
.find kbd { font-family: var(--mono); font-size: 12px; color: var(--text-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.save { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; white-space: nowrap; text-decoration: none; padding: 6px 8px; border-radius: 999px; }
.save:hover { background: var(--surface-2); color: var(--text-2); }
.save[data-state="memory"] { color: var(--warn); }
.save .ms { font-size: 18px; }
.save[data-state="error"] { color: var(--bad); }
.save[data-state="saving"], .save[data-state="unsaved"] { color: var(--text-2); }
.banner { margin: 0 28px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.view { padding: 8px 28px 96px; max-width: 1360px; width: 100%; outline: none; }
.boot { display: flex; align-items: center; gap: 12px; padding: 60px 0; color: var(--text-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--accent-soft-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .nav { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .nav { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }
  .menu-btn, .top-brand { display: inline-flex !important; }
  .top { padding: 8px 16px; }
  .view { padding: 4px 16px 110px; }
  .banner { margin: 0 16px; }
}
@media (max-width: 640px) {
  .find { display: none; }
  .find-btn { display: inline-flex !important; margin-left: auto; }
  .save { margin-left: 0; }
  .save span:not(.ms) { display: none; }
  body.search-open .find { display: flex; position: absolute; left: 12px; right: 12px; top: 8px; max-width: none; z-index: 2; box-shadow: var(--shadow-lg); }
}

/* ---------------------------------------------------------- page bits */
.page { display: flex; flex-direction: column; gap: 18px; padding-top: 10px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding-top: 6px; }
.page-title { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.page-title h1 { font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; }
.page-title h1.mono { font-size: 28px; font-weight: 600; }
.page-title .sub { color: var(--text-2); margin: 4px 0 0; line-height: 1.7; }
.back { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: var(--text-2); text-decoration: none; margin-top: -1px; flex: none; }
.back:hover { background: var(--surface-2); color: var(--text); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .page-title h1, .page-title h1.mono { font-size: 23px; }
  .page-actions { width: 100%; gap: 6px; }
  .page-actions .btn { height: 34px; padding: 0 12px; font-size: 13.5px; }
  .page-actions .btn .ms { font-size: 18px; }
  .page-actions .btn-icon { width: 34px; padding: 0; }
}
.filter-toggle { display: none; }
@media (max-width: 640px) {
  .filter-toggle { display: inline-flex; }
  .filters.collapsible:not(.open) > .opt { display: none; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 0; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; }
.card-extra { display: flex; align-items: center; gap: 6px; }
.card-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-body.flush { padding: 8px 0 6px; }
.card-body.flush > .tbl-wrap { border-radius: 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 17px; margin: 6px 0 4px; }
.empty .row { justify-content: center; margin-top: 12px; }
.empty-i { font-size: 40px !important; color: var(--text-3); }
.more { display: flex; justify-content: center; padding: 14px; }

/* ------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, box-shadow .12s; }
.btn .ms { font-size: 19px; margin-left: -3px; }
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow); }
.btn-tonal { background: var(--accent-soft); color: var(--accent-strong); }
.btn-tonal:hover { background: var(--accent-soft-2); }
.btn-text { background: transparent; color: var(--accent-strong); }
.btn-text:hover { background: var(--accent-soft); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 85%, #000); }
.btn-danger-text { background: transparent; color: var(--bad); }
.btn-danger-text:hover { background: var(--bad-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-sm .ms { font-size: 18px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 16px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon .ms { margin: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-text.btn-icon { color: var(--text-2); }

/* --------------------------------------------------------------- chips */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.chip .ms { font-size: 15px; }
.chip-xs { height: 20px; font-size: 11.5px; padding: 0 7px; margin-left: 6px; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-muted { background: var(--surface-2); color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sex { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; vertical-align: middle; flex: none; }
.sex .ms { font-size: 17px; }
.sex-M { background: var(--male-soft); color: var(--male); }
.sex-F { background: var(--female-soft); color: var(--female); border-radius: 50%; }
.sex-U { background: var(--surface-2); color: var(--text-3); }
.ctype { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.ctype::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: currentColor; }
.ctype-breeding { color: var(--t-breeding); } .ctype-holding { color: var(--t-holding); } .ctype-weaning { color: var(--t-weaning); } .ctype-quarantine { color: var(--t-quarantine); }
.warn { background: var(--warn-soft); color: var(--warn); padding: 9px 12px; border-radius: var(--r-sm); font-size: 14px; }
.warn-t { color: var(--warn); }
.bad-t { color: var(--bad); }
.ok-t { color: var(--ok); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-warn span { background: var(--warn); }
.bar-bad span { background: var(--bad); }

/* --------------------------------------------------------------- forms */
.inp { height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); min-width: 0; width: 100%; }
textarea.inp { height: auto; padding: 9px 12px; resize: vertical; }
select.inp { padding-right: 28px; appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp.mono { font-family: var(--mono); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--text-3); margin: 0; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.box { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px 12px; margin: 0; min-width: 0; }
.box legend { font-size: 13px; font-weight: 500; color: var(--text-2); padding: 0 4px; }
.geno-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.genes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.gene-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface); flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; height: 32px; border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.seg label .ms { font-size: 17px; }
.seg input:checked + label { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.seg input:focus-visible + label { outline: 2px solid var(--accent); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.check input, .cb input, td.cb input, .mchip input, .ggroup-h input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.inline { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline .inp { width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .inp { width: auto; height: 38px; }
.filters .inp-search { flex: 1 1 240px; min-width: 180px; }
.filters .inp-cage { width: 110px; }
.filters .inp-age { width: 88px; }
.inp-find { width: 170px; }
form.row { flex-wrap: nowrap; }
.age-range { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 640px) {
  .filters .inp, .filters select.inp { flex: 1 1 calc(50% - 8px); width: auto; min-width: 0; }
  .filters .inp-search { flex-basis: 100%; }
  .age-range { flex: 1 1 calc(50% - 8px); }
  .age-range .inp { flex: 1; }
}

/* -------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-sm); -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: default; }
.tbl-mice tbody tr, .page .tbl tbody tr:has(a.mono) { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl tr.ended td { color: var(--text-3); }
.tbl tr.bad td { background: var(--bad-soft); }
.tbl tr.total td { font-weight: 600; border-top: 2px solid var(--line-2); }
.tbl th.num { text-align: right; }
.tbl th.cb, .tbl td.cb { width: 34px; padding-right: 0; }
.tbl-tight td, .tbl-tight th { padding: 6px 8px; }
.tbl .geno { max-width: 280px; }
.sort { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; }
.sort .ms { font-size: 15px; }
.card > .card-body > .tbl-wrap .tbl th:first-child, .card > .card-body.flush .tbl td:first-child { padding-left: 18px; }
.card-body.flush .tbl th:last-child, .card-body.flush .tbl td:last-child { padding-right: 18px; }
.tbl-grid .gcell .inp-cell { height: 34px; width: auto; min-width: 84px; }
.tbl-grid .gcell.filled .inp-cell { border-color: var(--accent); background-color: var(--accent-soft); }
.show-xs { display: none; }
@media (max-width: 1100px) { .hide-md { display: none; } }
@media (max-width: 760px) { .hide-sm { display: none; } .tbl td, .tbl th { padding: 8px 6px; } }
@media (max-width: 520px) { .hide-xs { display: none; } .show-xs { display: block; } .tbl .btn-sm .ms { display: none; } .tbl .btn-sm { padding: 0 10px; } .tbl .chip { padding: 0 7px; } }

.bulk { position: fixed; left: 0; right: 0; bottom: 16px; z-index: 22; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }
.bulk-in { pointer-events: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); border-radius: 22px; padding: 8px 10px 8px 18px; max-width: 980px; }
@media (min-width: 961px) { .bulk { left: 252px; } }
@media (max-width: 560px) {
  .bulk-in { padding: 6px 6px 6px 14px; gap: 4px; flex-wrap: nowrap; }
  .bulk-in .btn:not(.btn-icon) { width: 38px; padding: 0; }
  .bulk-in .btn:not(.btn-icon) span:not(.ms) { display: none; }
  .bulk-in .btn .ms { margin: 0; }
  .bulk-in strong { white-space: nowrap; margin-right: 4px; }
}

/* -------------------------------------------------------------- dialog */
.dlg { border: 0; padding: 0; border-radius: 20px; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--shadow-lg); }
.dlg-wide { width: min(720px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(10, 12, 8, .45); }
.dlg-in { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 6px 22px; gap: 10px; }
.dlg-head h2 { font-size: 19px; }
.dlg-body { padding: 8px 22px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.dlg-err { background: var(--bad-soft); color: var(--bad); border-radius: var(--r-sm); padding: 9px 12px; font-weight: 500; margin: 0; }
@media (max-width: 560px) {
  .dlg, .dlg-wide { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .dlg-in { max-height: 92vh; }
  .dlg-foot .btn { flex: 1 1 auto; }
}
.plan { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.plan-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.plan-list li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* -------------------------------------------------------------- toasts */
.toasts { position: fixed; z-index: 1000; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: #23261f; color: #f1f3ea; padding: 10px 8px 10px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; animation: tin .18s ease; max-width: 100%; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .2s; }
.toast-error { background: #5b1712; }
.toast-msg { flex: 1; }
.toast-act { background: none; border: 0; color: #b9e6a5; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.toast-x { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; display: inline-flex; padding: 4px; border-radius: 8px; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #e9ece2; color: #1b1d17; } :root:not([data-theme="light"]) .toast-act { color: #2f662c; } :root:not([data-theme="light"]) .toast-error { background: #ffd9d4; color: #5b1712; } }


/* ---------------------------------------------------------------- home */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; text-decoration: none; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n i" "l l" "s s"; row-gap: 2px; }
a.stat:hover { border-color: var(--accent-soft-2); }
.stat-i { grid-area: i; width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; }
.stat-n { grid-area: n; font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { grid-area: l; color: var(--text-2); font-size: 14px; }
.stat-s { grid-area: s; color: var(--text-3); font-size: 12.5px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stats-3 { grid-template-columns: minmax(0, 1fr); } .stat-n { font-size: 26px; } .stat { padding: 12px 14px; } }
.home-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task-i { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.task-overdue .task-i { background: var(--bad-soft); color: var(--bad); }
.task-due .task-i { background: var(--warn-soft); color: var(--warn); }
.task-t { font-weight: 500; text-decoration: none; display: block; }
.task-t:hover { color: var(--accent-strong); }
.task-d { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .task { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "i b l" "i a a"; padding: 11px 14px; row-gap: 8px; }
  .task-i { grid-area: i; width: 32px; height: 32px; align-self: start; } .task-b { grid-area: b; } .task-l { grid-area: l; align-self: start; } .task-a { grid-area: a; }
}
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.hist li { padding: 9px 0; border-top: 1px solid var(--line); }
.hist li:first-child { border-top: 0; }
.hist-t { font-size: 14px; overflow-wrap: anywhere; }
.hist-m { color: var(--text-3); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.hist-links { display: inline-flex; flex-wrap: wrap; gap: 8px; margin-left: 8px; font-size: 12px; }
.hist-day { font-size: 13px; color: var(--text-2); margin: 16px 0 2px; }
.hist-day:first-child { margin-top: 0; }
.welcome { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--line); border-radius: 22px; padding: 30px; }
.welcome h2 { font-size: 24px; margin-bottom: 6px; }
.welcome .row { margin: 14px 0 10px; }
@media (max-width: 640px) { .welcome { grid-template-columns: minmax(0, 1fr); padding: 22px; } .welcome-art img { width: 64px; height: 64px; } }

/* ---------------------------------------------------------- mouse page */
.facts { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.facts > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--text-2); font-size: 13.5px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .facts > div { grid-template-columns: 110px minmax(0, 1fr); } }
.geno-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.geno-item .chip-xs { margin-left: 2px; }

/* --------------------------------------------------------------- cages */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; text-decoration: none; color: var(--text-2); font-weight: 500; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--accent-strong); border-bottom-color: var(--accent); }
.rack-scroll { overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.rack { display: grid; gap: 6px; min-width: min-content; --slot-w: 5.2rem; }
@media (max-width: 640px) { .rack { --slot-w: 4.4rem; gap: 4px; } .slot { min-height: 58px; padding: 5px 6px 5px 9px; } }
.rack-colh, .rack-rowh { color: var(--text-3); font-size: 12px; font-family: var(--mono); display: flex; align-items: center; justify-content: center; }
.slot { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-height: 66px; padding: 7px 8px 7px 11px; border-radius: 10px; text-decoration: none; background: var(--surface-2); border: 1px solid var(--line); position: relative; overflow: hidden; font-size: 12px; line-height: 1.25; }
.slot::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--t-holding); }
.slot-breeding::before { background: var(--t-breeding); } .slot-weaning::before { background: var(--t-weaning); } .slot-quarantine::before { background: var(--t-quarantine); }
a.slot:hover { border-color: var(--accent); background: var(--surface); }
.slot-id { font-weight: 600; font-size: 13px; }
.slot-n, .slot-s { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-s { color: var(--text-3); font-size: 11.5px; }
.slot-empty { background: transparent; border: 1.5px dashed var(--line-2); color: var(--text-3); align-items: center; font-family: var(--mono); cursor: pointer; padding: 0; }
.slot-empty::before { display: none; }
.slot-empty:hover, .slot-empty.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.slot.dragging { opacity: .4; }
.loose { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--text-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sw-breeding { background: var(--t-breeding); } .sw-holding { background: var(--t-holding); } .sw-weaning { background: var(--t-weaning); } .sw-quarantine { background: var(--t-quarantine); }
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .board { grid-template-columns: minmax(0, 1fr); } }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.col-head { display: flex; flex-direction: column; gap: 6px; }
.drop { min-height: 180px; border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.mchip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; cursor: grab; font-size: 13.5px; min-width: 0; flex-wrap: wrap; }
.mchip.sel { border-color: var(--accent); background: var(--accent-soft); }
.mchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.ggroups { display: flex; flex-direction: column; gap: 14px; }
.ggroup-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; cursor: pointer; flex-wrap: wrap; }
.ul, .plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.errs { margin: 0; padding-left: 18px; color: var(--bad); font-size: 13.5px; }

/* ------------------------------------------------------------ breeding */
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 400px) { .pairs { grid-template-columns: minmax(0, 1fr); } }
.pair { display: flex; flex-direction: column; }
.pair-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; gap: 8px; }
.pair-head > div { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.pair-b { padding: 4px 16px 8px; display: flex; flex-direction: column; gap: 6px; }
.breeder { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.pstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pstats-lg { grid-template-columns: repeat(3, minmax(0, 1fr)); border: 0; gap: 12px; }
.pstat { padding: 10px 8px; text-align: center; display: flex; flex-direction: column; }
.pstats-lg .pstat { background: var(--surface-2); border-radius: var(--r-sm); }
.pstat b { font-size: 19px; font-variant-numeric: tabular-nums; }
.pstat span { color: var(--text-2); font-size: 12px; }
.unweaned { padding: 10px 16px; font-size: 14px; }
.pair-foot { display: flex; justify-content: space-between; padding: 10px 12px 12px; margin-top: auto; gap: 8px; }
.fold summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 8px; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::before { content: "chevron_right"; font-family: "Material Symbols Rounded"; font-size: 20px; color: var(--text-2); transition: transform .15s; }
.fold[open] summary::before { transform: rotate(90deg); }
.fold summary h2 { font-size: 16px; }
.fold .tbl-wrap { padding: 0 8px 10px; }

/* -------------------------------------------------------- strains etc. */
.strains, .protos { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 400px) { .strains, .protos { grid-template-columns: minmax(0, 1fr); } }
.strain, .proto { text-decoration: none; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
a.strain:hover, a.proto:hover { border-color: var(--accent-soft-2); }
.strain-head, .proto-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.strain-head h3, .proto-head h3 { font-size: 17px; }
.strain-n { text-align: right; display: flex; flex-direction: column; line-height: 1.1; }
.strain-n b { font-size: 28px; font-variant-numeric: tabular-nums; }
.strain-n span { color: var(--text-2); font-size: 12px; }
.sexsplit { display: flex; align-items: center; gap: 6px; font-size: 13.5px; flex-wrap: wrap; }
.sexsplit .sex + span { margin-right: 8px; }
.bands { display: flex; flex-direction: column; gap: 5px; }
.band { display: grid; grid-template-columns: 82px minmax(0, 1fr) 28px; gap: 8px; align-items: center; font-size: 12px; color: var(--text-2); }
.band-bar { height: 10px; display: flex; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.band-m { background: var(--male); } .band-f { background: var(--female); } .band-u { background: var(--text-3); }
.band-n { text-align: right; font-variant-numeric: tabular-nums; }
.proto-bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.proto-warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.proto-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.big { font-size: 22px; font-weight: 600; }
.data-card { scroll-margin-top: 80px; }
.data-card.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: var(--shadow); } }
.data-more { border-top: 1px solid var(--line); padding-top: 10px; }
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 18px; align-items: start; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.map-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; align-items: center; font-size: 13.5px; }
.map-row .inp { height: 36px; }
.opts { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; padding-top: 6px; }

/* ------------------------------------------------------------ pedigree */
.ped-wrap { overflow-x: auto; padding: 8px 6px; -webkit-overflow-scrolling: touch; }
.ped { display: block; margin: 0 auto; font-family: var(--font); max-width: none; }
.ped-line { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.ped-node rect { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 1.2; }
.ped-node { cursor: pointer; }
.ped-node:hover rect, .ped-node:focus rect { stroke: var(--accent); stroke-width: 2; }
.ped-node:focus { outline: none; }
.ped-M rect { fill: var(--male-soft); stroke: color-mix(in srgb, var(--male) 45%, transparent); }
.ped-F rect { fill: var(--female-soft); stroke: color-mix(in srgb, var(--female) 45%, transparent); }
.ped-focus rect { stroke: var(--accent); stroke-width: 3; }
.ped-ended rect { stroke-dasharray: 4 3; opacity: .75; }
.ped-out rect { fill: var(--surface); stroke-dasharray: 2 3; }
.ped-out { cursor: default; }
.ped-unknown rect { fill: none; stroke: var(--line); stroke-dasharray: 3 3; }
.ped-unknown text { fill: var(--text-3); font-size: 12px; }
.ped-unknown { cursor: default; }
.ped-id { fill: var(--text); font-family: var(--mono); font-weight: 600; font-size: 13.5px; }
.ped-sub { fill: var(--text-2); font-size: 11px; }
.ped-sub2 { fill: var(--text-3); font-size: 10.5px; font-family: var(--mono); }
.ped-none { fill: var(--text-3); font-size: 13px; }
.ped-more rect { fill: var(--accent-soft); }
.ped-more text { fill: var(--accent-strong); font-size: 12px; font-weight: 500; }
.ped-more { cursor: pointer; }
.ped-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 18px 14px; color: var(--text-2); font-size: 12.5px; }
.ped-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 18px; height: 12px; border: 1.5px solid var(--line-2); }
.lg-m { background: var(--male-soft); border-radius: 2px; border-color: var(--male); }
.lg-f { background: var(--female-soft); border-radius: 99px; border-color: var(--female); }
.lg-u { background: var(--surface-2); border-radius: 5px; }
.lg-x { border-style: dashed; border-radius: 3px; }
.lg-o { border-style: dotted; border-radius: 3px; background: var(--surface); }

/* ---------------------------------------------------------- cage cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.ccard { background: #fff; color: #111; border: 1.5px solid #222; border-radius: 10px; padding: 12px 14px 8px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; min-height: 300px; position: relative; overflow: hidden; break-inside: avoid; page-break-inside: avoid; }
.ccard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--t-holding); }
.ccard-breeding::before { background: #c0567f; } .ccard-holding::before { background: #3e7d3a; } .ccard-weaning::before { background: #c98a14; } .ccard-quarantine::before { background: #6a5bb0; }
.cc-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding-top: 4px; }
.cc-id { min-width: 0; }
.cc-type { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #555; font-weight: 600; }
.cc-num { font-size: 26px; font-weight: 700; line-height: 1.05; color: #000; font-family: var(--mono); }
.cc-strain { font-size: 13px; font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.qr { width: 92px; height: 92px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.cc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 10px; font-size: 11px; color: #222; }
.cc-meta b { color: #666; font-weight: 500; }
.cc-mice { width: 100%; border-collapse: collapse; font-size: 11px; }
.cc-mice th { text-align: left; font-weight: 600; color: #555; border-bottom: 1px solid #999; padding: 2px 4px; font-size: 10px; }
.cc-mice td { padding: 2px 4px; border-bottom: 1px solid #ddd; color: #111; }
.cc-mice td.mono { font-family: var(--mono); }
.cc-more { font-size: 10.5px; color: #555; margin: 0; }
.cc-foot { margin-top: auto; display: flex; justify-content: space-between; font-size: 9.5px; color: #777; border-top: 1px solid #ddd; padding-top: 4px; }

@media print {
  @page { size: letter; margin: 0.35in; }
  html, body { background: #fff !important; color: #000; }
  .nav, .top, .banner, .toasts, .no-print, .scrim, .bulk, .skip { display: none !important; }
  .shell { display: block; }
  .view { padding: 0; max-width: none; }
  .page { gap: 0; padding: 0; }
  .cards { display: grid; grid-template-columns: repeat(2, 3.75in); grid-auto-rows: 3.3in; gap: 0.12in; justify-content: center; }
  .ccard { min-height: 0; height: 3.3in; box-shadow: none; border-radius: 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qr { width: 1.05in; height: 1.05in; }
  body:not([data-view="cards"]) .view { display: block; }
}
@media (max-width: 400px) { .cards { grid-template-columns: minmax(0, 1fr); } .qr { width: 80px; height: 80px; } }
