:root {
  --bg: #f2f4f8;
  --surface: #fcfdff;
  --ink: #1a2332;
  --muted: #5a6474;
  --accent: #1e3a5f;
  --accent-dark: #0f2744;
  --warn: #b45309;
  --danger: #b42318;
  --border: #d9d2c5;
  --shadow: 0 10px 30px rgba(31, 42, 36, 0.08);
  --radius: 14px;
  --btn-radius: 6px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(30, 58, 95, 0.12), transparent 40%),
    var(--bg);
  min-height: 100vh;
}

html:has(#app-view:not(.hidden)) {
  overflow: hidden;
  height: 100dvh;
}

body:has(#app-view:not(.hidden)) {
  overflow: hidden;
  height: 100dvh;
  width: 100%;
  position: fixed;
  inset: 0;
}

a { color: var(--accent); }

.shell {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  margin-bottom: 0;
  padding-top: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  background-image: radial-gradient(circle at top left, rgba(30, 58, 95, 0.12), transparent 40%);
  position: relative;
  z-index: 150;
}

.shell > main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

.topbar-brand {
  min-width: 0;
}

.topbar-farm {
  font-size: 0.9rem;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.brand-logo {
  display: block;
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-card .brand-logo {
  width: 2.5rem;
  height: 2.5rem;
}

.tank-volume-preview {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
}

.tank-volume-preview strong {
  color: var(--accent-dark);
  font-size: 1.05rem;
}


.nav-menu-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-menu-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--btn-radius);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.nav-menu-btn:hover {
  border-color: var(--accent);
}

.nav-menu-btn.active {
  border-color: var(--accent);
  background: rgba(30, 58, 95, 0.1);
  color: var(--accent-dark);
}

.nav-home-icon {
  display: block;
}

.nav-menu-icon {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
  margin-top: -0.15rem;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 200;
  min-width: 210px;
  max-width: min(280px, calc(100vw - 2.5rem));
  padding: 0.35rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(31, 42, 36, 0.14);
}

.nav-menu button {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.nav-menu button:hover {
  background: rgba(30, 58, 95, 0.1);
}

.nav-menu button.active {
  background: rgba(30, 58, 95, 0.14);
  color: var(--accent-dark);
  font-weight: 600;
}

.nav-menu-divider {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--border);
}

.nav-menu-signout {
  color: var(--muted);
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--btn-radius);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font: inherit;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.dashboard-stats-bar {
  display: flex;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  margin-bottom: 1rem;
}

.dashboard-stat-segment {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.85rem 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.15s;
}

.dashboard-stat-segment:not(:last-child) {
  border-right: 1px solid var(--border);
}

.dashboard-stat-segment:hover {
  background: rgba(30, 58, 95, 0.08);
}

.dashboard-stat-segment:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

.dashboard-stat-segment strong {
  font-size: 1.6rem;
  line-height: 1.1;
}

.dashboard-stat-segment span {
  color: var(--muted);
  font-size: 0.9rem;
}

.dashboard-stat-segment-warn strong {
  color: var(--warn);
}

.dashboard-breeding-ready {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.dashboard-breeding-ready-header {
  margin-bottom: 0.35rem;
}

.dashboard-breeding-ready-title {
  margin: 0;
}

.dashboard-breeding-ready-title-pulse {
  display: inline-block;
  animation: dashboard-breeding-ready-title-pulse 1.6s ease-in-out infinite;
}

@keyframes dashboard-breeding-ready-title-pulse {
  0%,
  100% {
    color: var(--ink);
    transform: scale(1);
  }
  50% {
    color: var(--accent);
    transform: scale(1.04);
  }
}

.dashboard-breeding-ready-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.dashboard-breeding-ready-icon {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 12px;
  line-height: 0;
}

.dashboard-breeding-ready-photo {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  background: #e8e2d7;
  border: 1px solid var(--border);
  display: block;
}

.dashboard-breeding-ready-icon:hover .dashboard-breeding-ready-photo,
.dashboard-breeding-ready-icon:focus-visible .dashboard-breeding-ready-photo {
  box-shadow: 0 0 0 2px var(--accent);
}

.dashboard-breeding-ready-icon:focus-visible {
  outline: none;
}

.dashboard-breeding-ready-sex {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.2rem;
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(31, 42, 36, 0.12);
  pointer-events: none;
}

.upcoming-kindles-table {
  table-layout: fixed;
}

.upcoming-kindles-col-due {
  width: 9.25rem;
}

.upcoming-kindles-col-actions {
  width: 6.75rem;
}

.upcoming-kindles-table th,
.upcoming-kindles-table td {
  padding-left: 0;
  padding-right: 0;
}

.upcoming-kindle-date {
  white-space: nowrap;
  vertical-align: middle;
  padding-right: 1.5rem;
}

.upcoming-kindle-pair {
  vertical-align: middle;
  padding-right: 1.25rem;
}

.upcoming-kindles-table .table-actions {
  width: 6.75rem;
  white-space: nowrap;
  vertical-align: middle;
  text-align: right;
  padding-left: 0.5rem;
}

.upcoming-kindles-table thead .table-actions {
  padding-right: 0;
}

.upcoming-kindles-table .table-actions .btn {
  margin-right: 0;
}

.upcoming-kindle-buck {
  font-weight: 500;
  line-height: 1.25;
}

.upcoming-kindle-doe {
  margin-top: 0.15rem;
  font-size: 0.9rem;
  color: var(--muted, #7a7268);
  line-height: 1.25;
}

h1, h2, h3 { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }

.page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.35rem;
  margin-bottom: 1rem;
}

.page-header h1,
.page-header h2,
.page-header h3,
.rabbit-detail-title-input {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  min-width: 0;
}

.page-header-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.page-header-close-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--btn-radius);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.page-header-close-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.page-header-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.page-header-menu-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: var(--btn-radius);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.page-header-menu-btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.page-header-menu-btn[aria-expanded="true"] {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.page-header-menu-icon {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
  margin-top: -0.15rem;
}

.page-header-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 150;
  min-width: 200px;
  max-width: min(280px, calc(100vw - 2rem));
  width: max-content;
  margin: 0;
  padding: 0.35rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(31, 42, 36, 0.14);
}

.page-header-menu .action-menu-title {
  margin: 0;
  padding: 0.35rem 1rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.page-header-menu .action-menu-divider {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--border);
}

.page-header-menu-item {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.page-header-menu-item:hover:not(:disabled) {
  background: rgba(30, 58, 95, 0.1);
}

.page-header-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-header-menu-item-danger {
  color: var(--danger);
}

.page-header-menu-item-emphasis {
  color: var(--accent-dark);
  font-weight: 600;
}

.page-header-intro {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0;
}

.card > .page-header {
  margin-bottom: 0.5rem;
}

form label {
  display: block;
  margin: 0.6rem 0 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

textarea { min-height: 80px; resize: vertical; }

.row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th, .table td {
  text-align: left;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid var(--border);
}

.table-spread {
  table-layout: fixed;
}

.table-spread .table-actions {
  width: 11rem;
  text-align: right;
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: #e8e2d7;
}

.rabbit-list-thumb-btn {
  position: relative;
  display: block;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 12px;
  line-height: 0;
}

.rabbit-list-photo {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
  background: #e8e2d7;
  display: block;
}

.rabbit-list-photo-sex {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.15rem;
  border-radius: 5px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  line-height: 1;
  pointer-events: none;
}

.rabbit-list-photo-sex .sex-symbol {
  min-width: auto;
  font-size: inherit;
}

.rabbit-list-thumb-btn:hover .rabbit-list-photo,
.rabbit-list-thumb-btn:focus-visible .rabbit-list-photo {
  box-shadow: 0 0 0 2px var(--accent, #1e3a5f);
}

.rabbit-list-thumb-btn:focus-visible {
  outline: none;
}

.rabbit-photo-section {
  flex: 0 1 280px;
  max-width: 280px;
}

.rabbit-photo-current {
  display: block;
  width: 100%;
  max-width: 280px;
  border-radius: 12px;
  object-fit: cover;
  aspect-ratio: 1;
}

.rabbit-photo-placeholder {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f5f1ea;
  font-size: 0.9rem;
}

.rabbit-photo-frame {
  position: relative;
  width: 100%;
}

.rabbit-photo-menu-wrap {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  z-index: 2;
}

.rabbit-photo-menu-btn {
  border: 1px solid var(--border);
  background: rgba(255, 253, 248, 0.94);
  color: var(--muted);
  border-radius: var(--btn-radius);
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  cursor: pointer;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.rabbit-photo-menu-btn:hover,
.rabbit-photo-menu-btn[aria-expanded="true"] {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
}

.rabbit-photo-menu-icon {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
}

.rabbit-photo-menu.page-header-menu {
  right: 0;
  left: auto;
  top: 100%;
  min-width: 10.5rem;
}

.rabbit-photo-menu-panel .page-header-menu-item {
  display: block;
  width: 100%;
  text-align: left;
}

.rabbit-camera-panel {
  margin-top: 0.75rem;
  max-width: 320px;
}

.rabbit-camera-panel video {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: #000;
}

.rabbit-camera-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.genetics-form {
  margin-top: 0.5rem;
}

.add-rabbit-form .form-section-title {
  margin: 1.25rem 0 0.65rem;
  font-size: 1rem;
}

.add-rabbit-form .form-section-title:first-of-type {
  margin-top: 0;
}

.genetics-parent {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem 1rem;
  margin: 0 0 1rem;
}

.genetics-parent legend {
  font-weight: 600;
  padding: 0 0.35rem;
}

.genetics-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.genetics-mode label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.genetics-panel .row {
  margin-bottom: 0.5rem;
}

.genetics-current {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.pedigree-tree {
  font-size: 0.9rem;
  line-height: 1.45;
}

.pedigree-node {
  margin: 0.2rem 0;
}

.pedigree-children {
  margin-top: 0.35rem;
  padding-left: 0.5rem;
  border-left: 2px solid var(--border);
}

.pedigree-notes {
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.family-tree-modal {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.family-tree-modal.hidden {
  display: none;
}

.family-tree-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.5);
  cursor: default;
}

.family-tree-modal-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 1.5rem));
  max-height: min(92vh, 900px);
  overflow: auto;
  margin: 0;
  padding: 1.25rem 1.5rem 1.5rem;
}

.family-tree-modal.family-tree-modal--wide {
  padding: 0.75rem;
}

.family-tree-modal.family-tree-modal--wide .family-tree-modal-panel {
  width: min(98vw, 1600px);
  max-height: 96vh;
}

.family-tree-modal-toolbar {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.family-tree-graph-summary {
  margin: 0 0 0.75rem;
}

.family-tree-graph-scroll {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #faf8f4;
}

.family-graph-svg {
  display: block;
  min-width: 100%;
}

.family-graph-node.is-subject rect {
  filter: drop-shadow(0 2px 4px rgba(30, 58, 95, 0.18));
}

.family-tree-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.family-tree-modal-title {
  margin: 0 2rem 1rem 0;
  font-size: 1.2rem;
}

.family-tree-modal-body {
  display: grid;
  gap: 1.5rem;
}

.family-tree-section-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--accent-dark);
}

.family-tree-ancestors {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 12rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.family-tree-gen {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 11rem;
  padding: 0 0.85rem;
}

.family-tree-gen:first-child {
  padding-left: 0;
}

.family-tree-gen:not(:last-child) {
  border-right: 2px solid var(--border);
  margin-right: 0.85rem;
}

.family-tree-gen-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.65rem;
  text-align: center;
}

.family-tree-gen-slots {
  flex: 1;
  display: grid;
  grid-template-rows: repeat(var(--slot-count), minmax(4.5rem, 1fr));
  gap: 0.5rem;
  align-items: center;
  min-height: calc(var(--family-tree-max-rows, 1) * 4.75rem);
}

.family-tree-slot {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  justify-content: center;
  position: relative;
}

.family-tree-slot-role {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.family-tree-node {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: #fff;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: default;
}

button.family-tree-node {
  cursor: pointer;
}

button.family-tree-node:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(31, 42, 36, 0.08);
}

.family-tree-node.sex-buck {
  border-left: 4px solid #5b8ec9;
}

.family-tree-node.sex-doe {
  border-left: 4px solid #c96b8e;
}

.family-tree-node.sex-unknown,
.family-tree-node.empty,
.family-tree-node.restricted,
.family-tree-node.circular {
  border-left: 4px solid #c8c0b4;
}

.family-tree-node.is-subject {
  border-color: var(--accent);
  background: #f3faf5;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.12);
}

.family-tree-node.manual {
  background: #faf8f4;
}

.family-tree-node-photo {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.4rem;
  object-fit: cover;
  flex-shrink: 0;
  background: #ebe5da;
}

.family-tree-node-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--muted);
}

.family-tree-node-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.family-tree-node-name {
  font-size: 0.88rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.family-tree-node-meta,
.family-tree-node-farm {
  font-size: 0.76rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.family-tree-unknown {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.family-tree-descendants {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--border);
}

.family-tree-descendants > li {
  margin: 0.5rem 0;
}

.family-tree-descendant-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.family-tree-descendant-row .family-tree-node {
  max-width: 18rem;
}

.family-tree-descendant-role {
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .family-tree-modal-panel {
    width: calc(100% - 1rem);
    padding: 1rem;
  }

  .family-tree-gen {
    min-width: 9.5rem;
  }

  .family-tree-node-photo {
    width: 2.25rem;
    height: 2.25rem;
  }
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background: #ebe5da;
}

.badge.warn { background: #fdecd5; color: var(--warn); }
.badge.danger { background: #fee4e2; color: var(--danger); }
.badge.ok { background: #d5e4f5; color: var(--accent-dark); }

.rabbits-page-toolbar {
  margin: 0;
}

.rabbits-page-toolbar .btn {
  margin: 0;
}

.rabbit-filters-panel {
  margin-bottom: 0.75rem;
}

.rabbit-filters-panel .rabbit-filter-summary {
  margin: 0;
}

.rabbit-filter-compact {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.rabbit-filters {
  margin-bottom: 0.75rem;
}

.rabbit-filters-row {
  align-items: end;
  gap: 0.75rem 1rem;
}

.rabbit-filters-row > div {
  flex: 1 1 140px;
  min-width: 120px;
}

.rabbit-filters-actions {
  flex: 0 0 auto;
  align-self: end;
}

.rabbit-filter-summary {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.hidden { display: none !important; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: min(420px, 100%);
}

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.toast {
  position: fixed;
  right: 1rem;
  bottom: 2.5rem;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  z-index: 20;
  max-width: 320px;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

.app-revision {
  position: fixed;
  right: 0.65rem;
  bottom: 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.9;
  z-index: 15;
  pointer-events: none;
  user-select: none;
}

.risk-list { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.risk-list li { margin: 0.25rem 0; }

.cages-tabs { margin-bottom: 1rem; }

.cages-tabs-row {
  display: contents;
}

.cages-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cages-add-btn,
.action-icon-btn {
  flex-shrink: 0;
  min-width: 2.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 600;
}

.view-icon-btn,
.edit-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
}

.action-icon {
  display: block;
}

.layout-area-tabs {
  flex-wrap: wrap;
}

.layout-editor .layout-area-tabs,
.layout-editor .layout-tier-tabs {
  margin-bottom: 0.75rem;
}

.layout-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-height: 0;
}

.layout-tab-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem;
  background: rgba(30, 58, 95, 0.08);
  flex-shrink: 0;
}

.layout-tab-bar-top {
  border-bottom: 1px solid var(--border);
}

.layout-tab-bar-tiers {
  border-bottom: 1px solid var(--border);
}

.layout-tab-bar-bottom {
  border-top: 1px solid var(--border);
}

.layout-area-tabs,
.layout-tier-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
}

.layout-editor .layout-toolbar { margin-bottom: 1rem; }

.layout-shell {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.layout-side {
  flex: 0 0 200px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.layout-shelf h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.layout-cage-props {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: rgba(30, 58, 95, 0.05);
}

.layout-cage-props h3 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
}

.layout-cage-props-name {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.layout-unplaced {
  min-height: 100px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: rgba(255, 253, 248, 0.8);
}

.layout-unplaced.drop-target {
  border-color: var(--accent);
  background: rgba(30, 58, 95, 0.08);
}

.layout-unplaced .layout-empty {
  margin: 0;
  font-size: 0.85rem;
}

.layout-canvas-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  max-width: 100%;
}

.layout-view {
  width: 100%;
}

.layout-editor .layout-canvas-wrap {
  padding: 1.35rem 0.75rem 0.75rem 2rem;
}

.layout-view .layout-canvas-wrap {
  display: block;
  width: 100%;
  padding: 0.65rem;
  background: rgba(30, 58, 95, 0.04);
  box-sizing: border-box;
}

.layout-view .layout-area-tabs,
.layout-view .layout-tier-tabs {
  margin-bottom: 0;
}

.layout-grid,
.layout-floor {
  position: relative;
  display: block;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent calc(var(--layout-grid-step, 50px) - 1px),
      rgba(30, 58, 95, 0.08) calc(var(--layout-grid-step, 50px) - 1px),
      rgba(30, 58, 95, 0.08) var(--layout-grid-step, 50px)
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc(var(--layout-grid-step, 50px) - 1px),
      rgba(30, 58, 95, 0.08) calc(var(--layout-grid-step, 50px) - 1px),
      rgba(30, 58, 95, 0.08) var(--layout-grid-step, 50px)
    ),
    rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: min(100%, 320px);
  box-sizing: border-box;
}

.layout-floor.drop-target,
.layout-grid.drop-target {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.layout-rulers {
  position: absolute;
  pointer-events: none;
  font-size: 0.62rem;
  color: var(--muted);
  z-index: 1;
}

.layout-rulers-x {
  left: 0;
  right: 0;
  top: -1.1rem;
  height: 1rem;
}

.layout-rulers-y {
  top: 0;
  bottom: 0;
  left: -1.6rem;
  width: 1.5rem;
}

.layout-ruler-x,
.layout-ruler-y {
  position: absolute;
  transform: translate(-50%, 0);
}

.layout-ruler-y {
  transform: translate(0, -50%);
}

.layout-cage-footprint-label strong {
  color: var(--accent-dark);
}

.layout-cell {
  display: none;
}

.layout-cage {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 0.3rem 0.4rem;
  cursor: grab;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  user-select: none;
  box-shadow: var(--shadow);
  position: relative;
}

.layout-cage.selected {
  outline: 3px solid var(--accent-dark);
  outline-offset: 1px;
}

.layout-cage.placed {
  z-index: 2;
  position: absolute;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.layout-cage.tier-2.placed { z-index: 3; }
.layout-cage.tier-3.placed { z-index: 4; }

.layout-drop-preview {
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: rgba(30, 58, 95, 0.12);
  box-sizing: border-box;
  z-index: 20;
  opacity: 0.8;
}

.layout-unplaced .layout-cage {
  align-self: flex-start;
}

.layout-tier-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(255, 253, 248, 0.9);
  border-radius: 4px;
  padding: 0 0.2rem;
}

.layout-cage-size {
  font-size: 0.7rem;
  color: var(--muted);
}

.layout-cage.over {
  border-color: var(--warn);
}

.layout-cage.dragging {
  opacity: 0.45;
  cursor: grabbing;
  pointer-events: none;
}

.layout-cage-name {
  font-weight: 600;
  word-break: break-word;
}

.layout-cage-count {
  color: var(--muted);
  font-size: 0.75rem;
}

.layout-cage-count.warn {
  color: var(--warn);
  font-weight: 600;
}

.layout-cage.has-solo-photo {
  padding: 0;
  overflow: hidden;
  justify-content: flex-end;
}

.layout-cage-photo {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.layout-cage.has-solo-photo .layout-cage-name,
.layout-cage.has-solo-photo .layout-cage-size,
.layout-cage.has-solo-photo .layout-cage-count {
  padding: 0 0.3rem 0.15rem;
}

.layout-cage.has-solo-photo .layout-tier-badge {
  z-index: 1;
}

.layout-grid.view-mode {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(30, 58, 95, 0.06);
}

.layout-grid.view-mode .layout-tier-badge {
  display: none;
}

.layout-grid.view-mode .layout-cell {
  display: none;
}

.layout-grid.view-mode .layout-cage {
  font-size: clamp(0.6rem, 1.1vmin, 0.8rem);
  line-height: 1.15;
  padding: 0.15rem 0.2rem;
  border-width: 1px;
  border-radius: 5px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.layout-grid.view-mode .layout-cage-size,
.layout-floor.view-mode .layout-cage-size {
  display: block;
  font-size: clamp(0.48rem, 0.85vmin, 0.62rem);
}

.layout-grid.view-mode .layout-cage-name {
  font-size: clamp(0.55rem, 1vmin, 0.72rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.layout-grid.view-mode .layout-cage-count {
  font-size: clamp(0.5rem, 0.95vmin, 0.68rem);
}

.layout-grid.view-mode .layout-cage.has-solo-photo {
  justify-content: flex-end;
}

.layout-grid.view-mode .layout-cage-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  flex: none;
  object-fit: cover;
  z-index: 0;
  opacity: 0.9;
}

.layout-grid.view-mode .layout-cage.has-solo-photo .layout-cage-name,
.layout-grid.view-mode .layout-cage.has-solo-photo .layout-cage-count {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0.05rem 0.15rem;
  background: rgba(255, 253, 248, 0.82);
}

.layout-room-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.layout-tier-actions {
  margin-top: -0.35rem;
}

.layout-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.layout-shell-view {
  flex-wrap: nowrap;
}

.layout-filter-unassigned {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.layout-filter-unassigned input {
  margin: 0;
}

.layout-cage-detail {
  min-width: 0;
}

.layout-cage-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.layout-cage-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.45);
  cursor: default;
}

.layout-cage-modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100% - 2rem));
  max-height: min(85vh, 640px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1rem 1.25rem;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(31, 42, 36, 0.2);
}

.layout-cage-modal-close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
}

.layout-cage-modal-close:hover {
  color: var(--text);
  background: rgba(31, 42, 36, 0.06);
}

.layout-cage-modal-panel .layout-cage-detail {
  padding-right: 1.5rem;
}

.mate-rest-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.mate-rest-confirm-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.45);
  cursor: default;
}

.mate-rest-confirm-panel {
  position: relative;
  z-index: 1;
  width: min(400px, calc(100% - 2rem));
  margin: 0;
}

.mate-rest-confirm-message {
  margin: 0 0 1rem;
  line-height: 1.45;
}

.mate-rest-confirm-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.layout-cage-detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.layout-cage-detail-name {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.layout-cage-detail-count {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.layout-cage-detail-count.warn {
  color: var(--warn);
  font-weight: 600;
}

.layout-cage-detail-body {
  margin-bottom: 0.25rem;
}

.layout-cage-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.layout-cage-detail-row:last-child {
  border-bottom: none;
}

.layout-cage-detail-row.empty {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

.layout-cage-detail-rabbit-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.layout-cage-detail-rabbit-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.3;
}

.layout-cage-rabbit-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn.btn-mate-blocked {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--muted);
  background: var(--surface);
}

.layout-rabbit-meta {
  font-size: 0.85rem;
}

.layout-rabbit-status {
  font-size: 0.85rem;
  color: var(--accent-dark);
  font-weight: 500;
}

.layout-cage-detail-actions {
  margin-top: 0.75rem;
}

.add-to-cage-panel {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.add-to-cage-form select {
  width: 100%;
  margin: 0.35rem 0 0.5rem;
}

.add-to-cage-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.add-rabbit-breeding-status.hidden {
  display: none;
}

.doe-breeding-status-form {
  margin: 0.75rem 0 0;
}

.doe-breeding-status-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.doe-breeding-status-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.doe-breeding-status-row select {
  flex: 1 1 160px;
}

.life-stage-form {
  margin: 0.75rem 0 0;
}

.life-stage-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.life-stage-form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.life-stage-form-row select {
  flex: 1 1 160px;
}

.temperament-form {
  margin: 0.5rem 0;
}

.temperament-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.temperament-form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.temperament-form-row select {
  flex: 1 1 160px;
}

.dob-form {
  margin: 0.5rem 0;
}

.dob-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.dob-form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.dob-form-row input[type="date"] {
  flex: 1 1 160px;
}

.rabbit-dates-row {
  margin: 0.5rem 0 0;
}

.rabbit-dates-field {
  margin: 0;
}

.rabbit-dates-field label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.rabbit-dates-field input[type="date"] {
  width: 100%;
  box-sizing: border-box;
}

.rabbit-dates-hint {
  margin: 0.35rem 0 0.5rem;
}

.birth-litter-form {
  margin: 0.5rem 0;
}

.birth-litter-form > label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.birth-litter-form-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.birth-litter-field {
  flex: 0 0 auto;
}

.birth-litter-field .sub-label {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.75rem;
  color: var(--muted, #5c6670);
}

.birth-litter-field input[type="number"] {
  width: 5rem;
  max-width: 100%;
}

.birth-litter-form-row .btn {
  margin-left: auto;
}

.rabbit-history-header,
.rabbit-profile-section-header {
  margin-top: 1.25rem;
}

.rabbit-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  text-align: left;
}

.rabbit-section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.rabbit-section-toggle-icon {
  font-size: 0.72rem;
  color: var(--muted);
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  line-height: 1;
}

.rabbit-section-toggle:hover .rabbit-section-toggle-icon,
.rabbit-section-toggle:focus-visible .rabbit-section-toggle-icon {
  color: var(--text);
}

.rabbit-section-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.rabbit-profile-section-body {
  margin-top: 0.35rem;
}

.rabbit-profile-section-body.hidden {
  display: none;
}

.rabbit-detail-topbar {
  margin: -0.25rem 0 0.75rem;
}

.rabbit-detail-topbar.page-header {
  margin-bottom: 0.75rem;
}

.rabbit-detail-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.rabbit-detail-info {
  min-width: 0;
}

.rabbit-detail-title {
  margin: 0;
}

.rabbit-detail-title-input {
  margin: 0;
  min-width: 0;
  width: 100%;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.25;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--btn-radius);
  padding: 0.15rem 0.35rem;
}

.rabbit-detail-title-input:hover,
.rabbit-detail-title-input:focus {
  border-color: var(--border);
  background: var(--surface);
  outline: none;
}

.rabbit-profile-save-btn.hidden {
  display: none;
}

.rabbit-profile-form-sink {
  display: none;
}

.rabbit-inactive-notice {
  margin: 0 0 0.75rem;
}

.rabbit-loan-return {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.rabbit-loan-return .rabbit-inactive-notice {
  margin: 0;
}

.rabbit-rename-form {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.rabbit-rename-form input {
  width: 100%;
  max-width: 24rem;
}

#rabbit-detail:not(:empty) {
  margin-bottom: 1rem;
}

.rabbit-age-label {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.rabbit-timeline {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.breeding-datetime-row input[type="time"] {
  min-width: 8.5rem;
}

.breeding-list-table th:last-child,
.breeding-list-table td.table-actions {
  width: 2.75rem;
  text-align: right;
  white-space: nowrap;
}

.breeding-list-table tr.breeding-list-row-success td {
  background: rgba(30, 58, 95, 0.14);
}

.breeding-list-table tr.breeding-list-row-failed td {
  background: rgba(199, 80, 80, 0.12);
}

.breeding-list-table tr.breeding-list-row-success:hover td {
  background: rgba(30, 58, 95, 0.22);
}

.breeding-list-table tr.breeding-list-row-failed:hover td {
  background: rgba(199, 80, 80, 0.18);
}

.breeding-list-table td.table-actions .btn {
  padding: 0.35rem 0.5rem;
}

.breeding-notes-cell {
  max-width: 16rem;
  font-size: 0.9rem;
}

.breeding-note-line + .breeding-note-line {
  margin-top: 0.35rem;
}

.breeding-notes-row textarea {
  min-height: 4rem;
}

.breeding-completed-table .breeding-summary-cell {
  font-size: 0.95rem;
}

.breeding-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.breeding-detail-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.45);
  cursor: default;
}

.breeding-detail-modal-panel {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100% - 2rem));
  max-height: min(85vh, 640px);
  overflow: auto;
  margin: 0;
}

.breeding-detail-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.breeding-detail-dl {
  display: grid;
  gap: 0.65rem 1rem;
  margin: 0 0 1rem;
}

.breeding-detail-dl > div {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.5rem 1rem;
  align-items: start;
}

.breeding-detail-dl dt {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}

.breeding-detail-dl dd {
  margin: 0;
}

.breeding-detail-notes h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.breeding-detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}

.pairing-history-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.pairing-history-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.pairing-history-item:last-child {
  border-bottom: none;
}

.pairing-note {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.rabbit-timeline-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.5rem 0 0.5rem 0.75rem;
  margin-left: 0.35rem;
  position: relative;
}

.rabbit-timeline-item .rabbit-timeline-delete {
  margin-left: auto;
}

.rabbit-timeline-item::before {
  content: "";
  position: absolute;
  left: -0.45rem;
  top: 0.85rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}

.rabbit-timeline-item.type-health::before {
  background: var(--danger);
}

.rabbit-timeline-item.type-mated::before,
.rabbit-timeline-item.type-kindled::before,
.rabbit-timeline-item.type-born::before {
  background: var(--accent-dark);
}

.rabbit-timeline-date {
  flex: 0 0 6.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.rabbit-timeline-body {
  flex: 1 1 auto;
  min-width: 0;
}

.rabbit-timeline-summary {
  font-size: 0.92rem;
}

.rabbit-timeline-details {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.rabbit-timeline-delete {
  flex-shrink: 0;
  padding: 0.1rem 0.45rem;
  line-height: 1.2;
  font-size: 1.1rem;
}

.add-history-form textarea {
  width: 100%;
  min-height: 3rem;
}

.weight-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 5rem;
  margin: 0.5rem 0 0.75rem;
  padding: 0.5rem 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

.weight-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
}

.weight-bar {
  width: 100%;
  max-width: 2.5rem;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
}

.weight-bar-label {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.weight-trend-summary {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.weight-trend-summary.up,
.weight-change.up {
  color: #2d6a3e;
}

.weight-trend-summary.down,
.weight-change.down {
  color: #a33;
}

.weight-table td {
  vertical-align: middle;
}

.weight-form .row {
  gap: 1rem;
}

.farm-rules-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.farm-rules-list li {
  margin: 0.25rem 0;
}

.farm-rules-form .farm-rules-field {
  margin-bottom: 1rem;
}

.farm-rules-field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 12rem;
}

.farm-rules-field-row input {
  flex: 1;
}

.farm-rules-hint {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}

.network-loans-subhead {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.network-loans-subhead:first-of-type {
  margin-top: 0.5rem;
}

.network-loans-table {
  margin-bottom: 0.25rem;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calendar-title {
  margin: 0;
  font-size: 1.15rem;
  text-align: center;
  flex: 1;
}

.cal-grid-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.cal-cell {
  min-height: 3.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.cal-cell-empty {
  border: none;
  background: transparent;
  min-height: 0;
}

.cal-cell:hover:not(.cal-cell-empty) {
  border-color: var(--accent);
}

.cal-today {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.cal-selected:not(.cal-day-cycle) {
  background: rgba(30, 58, 95, 0.12);
  border-color: var(--accent-dark);
}

.cal-cell.cal-day-mated:not(.cal-day-cycle) {
  background: rgba(30, 58, 95, 0.22);
  border-color: var(--accent-dark);
}

.cal-cell.cal-day-cycle {
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.cal-cell.cal-day-cycle-2 {
  animation-duration: 4s;
}

.cal-cell.cal-day-cycle-3 {
  animation-duration: 6s;
}

.cal-cell.cal-day-cycle.cal-selected {
  box-shadow: inset 0 0 0 2px var(--accent-dark);
}

@keyframes cal-hl-cycle-health-due-expected-kindle {
  0%,
  49.999% {
    background-color: rgba(199, 80, 80, 0.2);
    border-color: #c75050;
  }
  50%,
  100% {
    background-color: rgba(122, 90, 199, 0.24);
    border-color: #7a5ac7;
  }
}

@keyframes cal-hl-cycle-health-due-mated {
  0%,
  49.999% {
    background-color: rgba(199, 80, 80, 0.2);
    border-color: #c75050;
  }
  50%,
  100% {
    background-color: rgba(30, 58, 95, 0.22);
    border-color: var(--accent-dark);
  }
}

@keyframes cal-hl-cycle-expected-kindle-mated {
  0%,
  49.999% {
    background-color: rgba(122, 90, 199, 0.24);
    border-color: #7a5ac7;
  }
  50%,
  100% {
    background-color: rgba(30, 58, 95, 0.22);
    border-color: var(--accent-dark);
  }
}

@keyframes cal-hl-cycle-health-due-expected-kindle-mated {
  0%,
  33.332% {
    background-color: rgba(199, 80, 80, 0.2);
    border-color: #c75050;
  }
  33.333%,
  66.666% {
    background-color: rgba(122, 90, 199, 0.24);
    border-color: #7a5ac7;
  }
  66.667%,
  100% {
    background-color: rgba(30, 58, 95, 0.22);
    border-color: var(--accent-dark);
  }
}

.cal-cell.cal-day-cycle-2.cal-day-cycle-health-due-expected-kindle {
  animation-name: cal-hl-cycle-health-due-expected-kindle;
}

.cal-cell.cal-day-cycle-2.cal-day-cycle-health-due-mated {
  animation-name: cal-hl-cycle-health-due-mated;
}

.cal-cell.cal-day-cycle-2.cal-day-cycle-expected-kindle-mated {
  animation-name: cal-hl-cycle-expected-kindle-mated;
}

.cal-cell.cal-day-cycle-3.cal-day-cycle-health-due-expected-kindle-mated {
  animation-name: cal-hl-cycle-health-due-expected-kindle-mated;
}

@media (prefers-reduced-motion: reduce) {
  .cal-cell.cal-day-cycle {
    animation: none;
  }

  .cal-cell.cal-day-cycle-2.cal-day-cycle-health-due-expected-kindle {
    background-color: rgba(199, 80, 80, 0.2);
    border-color: #c75050;
  }

  .cal-cell.cal-day-cycle-2.cal-day-cycle-health-due-mated {
    background-color: rgba(199, 80, 80, 0.2);
    border-color: #c75050;
  }

  .cal-cell.cal-day-cycle-2.cal-day-cycle-expected-kindle-mated {
    background-color: rgba(122, 90, 199, 0.24);
    border-color: #7a5ac7;
  }

  .cal-cell.cal-day-cycle-3.cal-day-cycle-health-due-expected-kindle-mated {
    background-color: rgba(199, 80, 80, 0.2);
    border-color: #c75050;
  }
}

.cal-cell.cal-day-expected-kindle:not(.cal-day-cycle) {
  background: rgba(122, 90, 199, 0.24);
  border-color: #7a5ac7;
}

.cal-cell.cal-day-health-due:not(.cal-day-cycle) {
  background: rgba(199, 80, 80, 0.2);
  border-color: #c75050;
}

.cal-cell.cal-day-mated.cal-selected:not(.cal-day-cycle) {
  background: rgba(30, 58, 95, 0.3);
  border-color: var(--accent-dark);
}

.cal-cell.cal-day-expected-kindle.cal-selected:not(.cal-day-cycle) {
  background: rgba(122, 90, 199, 0.32);
  border-color: #6a4ab7;
}

.cal-cell.cal-day-health-due.cal-selected:not(.cal-day-cycle) {
  background: rgba(199, 80, 80, 0.28);
  border-color: #b54545;
}

.cal-day-num {
  font-size: 0.85rem;
  font-weight: 600;
}

.cal-dots {
  display: flex;
  gap: 2px;
  margin-top: 0.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-dot.type-mated {
  background: #5a7fc7;
}

.cal-dot.type-mated-successful {
  background: var(--accent-dark);
}

.cal-dot.type-expected_kindle {
  background: #7a5ac7;
}

.cal-dot.type-kindled {
  background: #c75a8a;
}

.cal-dot.type-born {
  background: #7a5ac7;
}

.cal-dot.type-weight {
  background: #8a6a3d;
}

.cal-dot.type-health,
.cal-dot.type-health_followup {
  background: #c75050;
}

.cal-day-detail {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.cal-day-detail h4 {
  margin: 0 0 0.75rem;
}

.cal-event-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cal-event-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.cal-event-item:last-child {
  border-bottom: none;
}

.cal-event-type {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-right: 0.5rem;
}

.cal-event-summary {
  font-weight: 500;
}

.cal-event-rabbit {
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.8rem;
}

.cal-event-details {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .btn {
  margin-right: 0.35rem;
}

.table-actions .action-menu-wrap {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0;
}

.rabbits-table th:nth-child(1),
.rabbits-table td:nth-child(1) {
  width: 1%;
  padding-right: 0.65rem;
  vertical-align: top;
}

.rabbits-table-photo-col {
  width: 1%;
}

.rabbit-list-details-col {
  width: auto;
}

.rabbit-list-details-col .rabbit-sort-heading + .rabbit-sort-heading {
  margin-left: 1rem;
}

.rabbit-list-details-cell {
  vertical-align: top;
  width: 100%;
}

.rabbit-list-name {
  font-weight: 500;
  line-height: 1.2;
}

.rabbit-list-breed {
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: var(--muted, #7a7268);
  line-height: 1.2;
}

.rabbit-list-status {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  line-height: 1.2;
  color: var(--text, #1f2a24);
}

.rabbit-sort-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.rabbit-sort-btn {
  border: none;
  background: transparent;
  padding: 0.1rem 0.15rem;
  line-height: 1;
  cursor: pointer;
  color: #d4cdc2;
  vertical-align: middle;
}

.rabbit-sort-btn:hover {
  color: #a8a095;
}

.rabbit-sort-btn-active {
  color: var(--accent);
}

.rabbit-sort-btn-active:hover {
  color: var(--accent-dark);
}

.rabbit-sort-icon {
  display: block;
  font-size: 0.65rem;
}

.sex-symbol {
  display: inline-block;
  min-width: 1.25rem;
}

.rabbit-stock-leave-wrap {
  position: relative;
}

.rabbit-stock-leave-wrap .action-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 50;
  margin-top: 0;
  width: min(260px, calc(100vw - 2rem));
}

.rabbit-detail-topbar .page-header-actions {
  grid-column: 2;
  grid-row: 1;
}

.table-actions .btn:last-child {
  margin-right: 0;
}

.cages-list-table th:not(:first-child),
.cages-list-table td:not(:first-child) {
  text-align: center;
}

.cages-list-table .cage-rabbits-cell {
  justify-content: center;
  max-width: none;
  margin: 0 auto;
}

.cages-list-table .table-actions {
  width: 3.5rem;
  text-align: center;
  white-space: nowrap;
}

.cage-list-actions-wrap {
  display: inline-flex;
  justify-content: center;
  margin-left: 0;
}

.cage-list-actions-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 30;
  min-width: 8.5rem;
  margin-top: 0.25rem;
}

.cage-list-actions-menu .page-header-menu-item {
  display: block;
  width: 100%;
  text-align: left;
}

.cage-rabbits-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  max-width: 12rem;
}

.cage-rabbit-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: #e8e2d7;
  flex-shrink: 0;
}

.cage-rabbits-cell-over .cage-rabbit-thumb {
  box-shadow: 0 0 0 2px var(--warn);
}

.team-table select {
  min-width: 6rem;
}

.team-member-self td {
  background: rgba(30, 58, 95, 0.06);
}

.layout-cage-detail h3 {
  margin: 0 0 0.35rem;
}

.layout-cage-view {
  cursor: pointer;
}

.layout-cage-view:hover {
  border-color: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(31, 42, 36, 0.12);
}

.layout-cage-view.selected {
  outline: 3px solid var(--accent-dark);
  outline-offset: 1px;
}

.layout-grid.view-mode .layout-cage.layout-cage-locate-highlight {
  overflow: visible;
  z-index: 30;
}

.layout-cage.layout-cage-locate-highlight {
  background: rgba(30, 58, 95, 0.42) !important;
  border-color: var(--accent-dark) !important;
  outline: 3px solid var(--accent-dark);
  outline-offset: 1px;
  box-shadow:
    0 0 0 2px rgba(30, 58, 95, 0.45),
    0 0 16px rgba(30, 58, 95, 0.35);
  z-index: 30;
  animation: layout-cage-locate-glow 2.55s ease-in-out infinite;
}

.layout-cage-locate-pulse {
  position: absolute;
  inset: -3px;
  border: 2px solid var(--accent-dark);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  animation: layout-cage-locate-radar 2.55s cubic-bezier(0.15, 0.5, 0.35, 1) infinite;
}

@keyframes layout-cage-locate-radar {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  65%,
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

@keyframes layout-cage-locate-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 2px rgba(30, 58, 95, 0.45),
      0 0 14px rgba(30, 58, 95, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 5px rgba(30, 58, 95, 0.55),
      0 0 24px rgba(30, 58, 95, 0.55);
  }
}

.layout-cage-rabbit-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.layout-cage-rabbit-item:last-child {
  border-bottom: none;
}

.action-menu-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
}

.action-menu-wrap:has(.action-menu:not(.hidden)) {
  flex: 1 1 100%;
  align-items: stretch;
}

.action-menu-wrap:has(.action-menu:not(.hidden)) .action-menu {
  width: 100%;
}

.action-menu {
  width: min(100%, 260px);
  margin-top: 0.35rem;
  padding: 0.35rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.action-menu-title {
  margin: 0;
  padding: 0.35rem 0.75rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.action-menu-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.action-menu-item:hover:not(:disabled) {
  background: rgba(30, 58, 95, 0.1);
}

.action-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-menu-divider {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--border);
}

.action-menu-sub {
  padding: 0.5rem 0.75rem 0.35rem;
  border-top: 1px solid var(--border);
}

.action-menu-sub label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.action-menu-sub select {
  width: 100%;
  margin-bottom: 0.5rem;
}

.action-menu-sub-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.layout-rabbit-thumb-btn {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 8px;
}

.layout-rabbit-thumb-btn:hover .layout-rabbit-thumb,
.layout-rabbit-thumb-btn:focus-visible .layout-rabbit-thumb {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.layout-rabbit-thumb-btn:focus-visible {
  outline: none;
}

.layout-rabbit-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.health-finding {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  max-width: 16rem;
}

.health-closed-date {
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.health-issues-closed-heading {
  margin-top: 1.5rem;
}

.health-close-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.health-close-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.45);
  cursor: default;
}

.health-close-modal-panel {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 2rem));
  max-height: min(85vh, 520px);
  overflow: auto;
  margin: 0;
}

.find-rabbit-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.find-rabbit-modal.hidden {
  display: none;
}

.find-rabbit-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.45);
  cursor: default;
}

.find-rabbit-modal-panel {
  position: relative;
  z-index: 1;
  width: min(480px, calc(100% - 2rem));
  max-height: min(85vh, 560px);
  overflow: auto;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.find-rabbit-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--btn-radius);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
}

.find-rabbit-search-label {
  display: block;
  font-size: 0.9rem;
}

.find-rabbit-search {
  width: 100%;
  box-sizing: border-box;
}

.find-rabbit-results {
  min-height: 2rem;
}

.find-rabbit-hint,
.find-rabbit-more {
  margin: 0;
  font-size: 0.9rem;
}

.find-rabbit-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.find-rabbit-result {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  background: var(--surface);
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.find-rabbit-result:hover,
.find-rabbit-result:focus {
  border-color: var(--primary);
  background: var(--surface-alt, #f8f9fa);
  outline: none;
}

.find-rabbit-result-photo {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-alt, #eee);
}

.find-rabbit-result-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.find-rabbit-result-name {
  font-size: 0.95rem;
}

.find-rabbit-result-meta {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rabbit-photo-analysis-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.rabbit-photo-analysis-modal.hidden {
  display: none;
}

.rabbit-photo-analysis-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.45);
  cursor: default;
}

.rabbit-photo-analysis-panel {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 2rem));
  max-height: min(85vh, 520px);
  overflow: auto;
  margin: 0;
}

.rabbit-photo-analysis-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--btn-radius);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
}

.rabbit-photo-analysis-intro {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.rabbit-photo-analysis-results {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.rabbit-photo-analysis-results div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.rabbit-photo-analysis-results dt {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.rabbit-photo-analysis-results dd {
  margin: 0;
  font-weight: 600;
}

.rabbit-photo-analysis-notes {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.rabbit-photo-analysis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.recommended-bucks-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.recommended-bucks-modal.hidden {
  display: none;
}

.recommended-bucks-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(31, 42, 36, 0.45);
  cursor: default;
}

.recommended-bucks-modal-panel {
  position: relative;
  z-index: 1;
  width: min(640px, calc(100% - 2rem));
  max-height: min(88vh, 780px);
  margin: 0;
  margin-bottom: 0;
  padding: 1.1rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
}

.recommended-bucks-modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--btn-radius);
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
}

.recommended-bucks-modal-head {
  flex: 0 0 auto;
  padding-right: 2.5rem;
}

.recommended-bucks-modal-head h3 {
  margin: 0 0 0.35rem;
}

.recommended-bucks-modal-subtitle {
  margin: 0 0 0.65rem;
}

.recommended-bucks-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.recommended-bucks-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  cursor: pointer;
}

.recommended-bucks-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.recommended-bucks-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.recommended-buck-card {
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  padding: 0.85rem 0.9rem;
  background: var(--surface);
}

.recommended-buck-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.recommended-buck-card-header-left {
  min-width: 0;
  flex: 1 1 auto;
}

.recommended-buck-name {
  display: block;
  font-size: 1.05rem;
  line-height: 1.25;
}

.recommended-buck-farm {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  line-height: 1.35;
}

.recommended-buck-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.recommended-buck-score {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.buck-rec-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.buck-rec-label-best {
  background: #d4edda;
  color: #155724;
}

.buck-rec-label-good {
  background: #d1ecf1;
  color: #0c5460;
}

.buck-rec-label-caution {
  background: #fff3cd;
  color: #856404;
}

.buck-rec-label-avoid {
  background: #f8d7da;
  color: #721c24;
}

.recommended-buck-meta {
  margin-bottom: 0.65rem;
}

.recommended-buck-meta > div {
  grid-template-columns: 7.5rem 1fr;
}

.recommended-buck-reasons {
  margin: 0 0 0.75rem;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.recommended-buck-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.recommended-buck-actions .btn {
  width: auto;
}

.recommended-bucks-modal-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.recommended-bucks-modal-footer .btn {
  width: auto;
}

@media (max-width: 700px) {
  .topbar-farm {
    white-space: normal;
  }

  .rabbit-list-thumb-btn {
    width: 72px;
    height: 72px;
  }

  .rabbit-list-photo-sex {
    min-width: 1.25rem;
    height: 1.25rem;
    font-size: 0.78rem;
  }

  .rabbits-table td,
  .rabbits-table th {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .rabbit-detail-body {
    gap: 1rem;
  }

  .rabbit-photo-section {
    width: 100%;
    max-width: none;
    flex: none;
  }

  .rabbit-photo-current,
  .rabbit-photo-placeholder {
    width: 100%;
    max-width: none;
    max-height: min(85vw, 420px);
    margin: 0 auto;
  }

  .rabbit-camera-panel {
    max-width: none;
    width: 100%;
  }
}

@media (min-width: 701px) {
  .rabbit-detail-body {
    flex-direction: row;
    align-items: flex-start;
  }

  .rabbit-detail-info {
    flex: 1 1 auto;
  }
}

.water-chart-wrap {
  margin-top: 0.5rem;
}

.water-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding: 0.5rem;
  background: var(--surface-2, rgba(0, 0, 0, 0.04));
  border-radius: 6px;
}

.water-chart-bar {
  flex: 1 1 4px;
  min-width: 4px;
  max-width: 12px;
  background: var(--accent, #1e3a5f);
  border-radius: 2px 2px 0 0;
  opacity: 0.85;
}

.species-image-picker {
  margin-top: 0.75rem;
}

.species-image-picker-intro {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
}

.species-image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.species-image-picker-option {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface, #fffdf8);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.species-image-picker-option:hover,
.species-image-picker-option:focus-visible {
  border-color: var(--accent, #1e3a5f);
  outline: none;
}

.species-image-picker-option.is-selected {
  border-color: var(--accent, #1e3a5f);
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.15);
}

.species-image-picker-option:disabled {
  opacity: 0.7;
  cursor: wait;
}

.species-image-picker-option img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f5f1ea;
}

.species-image-picker-label {
  font-size: 0.82rem;
  line-height: 1.25;
  font-weight: 600;
}

.species-image-picker-source {
  font-size: 0.75rem;
}

.species-image-picker-actions {
  margin-top: 0.75rem;
}

