/* app/styles.css - LoftBoss phase 1 */

/* ---------- Base mechanics (adapted from starter-kit/kit/base.css - keep these rules) ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }
body { margin: 0; line-height: 1.55; overflow-wrap: break-word; }
img, svg, video, canvas { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; line-height: 1.4; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.15; }
:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 2px; }
.skip-link { position: absolute; left: 1rem; top: -4rem; padding: .6rem 1rem; z-index: 200; background: #fff; color: #000; border-radius: 6px; }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ---------- Brand tokens ---------- */
:root {
  --navy: #041E3A;
  --deep-blue-1: #0A3F73;
  --deep-blue-2: #00305C;
  --brand-blue: #0071E3;
  --bright-blue: #00A8FF;
  --white: #FFFFFF;

  --topbar-height: 56px;
  --bottomnav-height: 64px;
  --rail-width: 76px;

  --bg: var(--white);
  --text: var(--navy);
  --text-muted: #46597A;
  --surface: #F2F5F9;
  --surface-border: #C9D4E2;
  --danger: #B3261E;

  --font-heading: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

html[data-theme="dark"] {
  --bg: var(--navy);
  --text: var(--white);
  --text-muted: #A9C0DC;
  --surface: #0A2744;
  --surface-border: #1C4269;
  --danger: #FF6B61;
}

html, body { background: var(--bg); color: var(--text); }
body { font-family: var(--font-body); min-height: 100vh; }

h1, h2, h3, h4, .page-title, .breed-tile__name {
  font-family: var(--font-heading);
}

.page-title { font-weight: 800; font-size: 1.6rem; margin: 0 0 1rem; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.3;
  border-radius: 10px;
  padding: .7rem 1.1rem;
  border: 2px solid transparent;
  min-height: 44px;
}
.btn--primary { background: var(--brand-blue); color: var(--white); }
.btn--primary:hover { background: var(--deep-blue-1); }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--surface-border); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--link { background: none; border: 0; color: var(--brand-blue); font-weight: 600; padding: .3rem .4rem; min-height: 44px; display: inline-flex; align-items: center; text-decoration: underline; }
.btn--small { padding: .45rem .75rem; min-height: 44px; font-size: .9rem; }
.btn--photo { background: var(--surface); color: var(--text); border: 2px solid var(--surface-border); display: block; width: 100%; text-align: center; font-weight: 700; }

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; min-width: 0; max-width: 100%; }
.filter-label select { max-width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

/* ---------- Native controls: explicit light/dark styling (select, date, datetime, file) ----------
   .form-control is the same shared class every date/datetime-local field in
   vaccinations and health records uses explicitly (see viewVaccinations.js,
   viewHealthRecords.js); the bare type selectors below mean every other date/
   datetime-local input (e.g. viewTreatments.js's Start field) gets the same
   border/radius/min-height for free, with no class needed there. */
select, input[type="date"], input[type="datetime-local"], input[type="text"], input[type="number"], input[type="file"], textarea, .form-control {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--surface-border);
  border-radius: 8px;
  padding: .6rem .75rem;
  min-height: 44px;
  line-height: 1.4;
}
textarea { min-height: 88px; }
select { appearance: auto; }
input[type="date"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator { opacity: 1; }
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator, html[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
input[type="file"] { padding: .4rem; }
input[type="file"]::file-selector-button {
  background: var(--surface); color: var(--text); border: 1px solid var(--surface-border);
  border-radius: 6px; padding: .4rem .7rem; font: inherit; margin-right: .6rem;
}

/* ---------- Form ---------- */
.bird-form { display: flex; flex-direction: column; gap: 1.1rem; max-width: 560px; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label, .field-label { font-weight: 600; font-size: .95rem; }
.field-error { color: var(--danger); font-size: .9rem; margin: 0; }
.field-hint { font-size: .85rem; color: var(--text-muted); min-height: 1.2em; margin: 0; }
.form-message { font-size: .95rem; color: var(--danger); min-height: 1.2em; }
.form-actions { display: flex; gap: .75rem; margin-top: .5rem; }

.photo-field { gap: .6rem; }
.photo-preview { border-radius: 12px; overflow: hidden; }
.photo-preview__img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 12px; display: block; }
.photo-preview__placeholder {
  background: var(--surface); border: 2px dashed var(--surface-border); border-radius: 12px;
  min-height: 180px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-weight: 600; padding: 1rem;
}

.genetics-field { gap: .75rem; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: 1rem 1.1rem; }
.chip-group { display: flex; gap: .6rem; flex-wrap: wrap; }
.chip {
  background: var(--bg); border: 2px solid var(--surface-border); color: var(--text);
  border-radius: 999px; padding: .5rem 1rem; font-weight: 600; min-height: 44px;
}
.chip[aria-pressed="true"] { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--white); }
.genetics-credit { font-size: .88rem; color: var(--text-muted); margin: 0; }
.genetics-credit a { color: var(--brand-blue); }

/* ---------- Breed browse ---------- */
.breed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.breed-tile {
  min-height: 160px; border-radius: 14px; border: 0; padding: 1.25rem;
  display: flex; flex-direction: column; justify-content: flex-end; gap: .4rem;
  text-align: left; color: var(--white);
  background: var(--deep-blue-1);
}
.breed-tile:nth-child(even) { background: var(--deep-blue-2); }
.breed-tile:hover { outline: 2px solid var(--bright-blue); outline-offset: 2px; }
.breed-tile__name { font-weight: 700; font-size: 1.3rem; }
.breed-tile__count { font-family: var(--font-body); font-size: .95rem; color: color-mix(in srgb, var(--white) 82%, transparent); }

/* ---------- Bird list ---------- */
.breed-filter-banner { display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 10px; padding: .6rem 1rem; margin-bottom: 1rem; font-weight: 600; }
.banner-wrap:empty { display: none; }
.banner { display: flex; align-items: center; gap: .75rem; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; }
.empty-state { color: var(--text-muted); padding: 2rem 0; }

.bird-group__subtitle { font-size: .95rem; font-weight: 700; color: var(--text-muted); margin: .75rem 0 .4rem; }

.bird-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.bird-row {
  display: flex; gap: 1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: .75rem;
}
.bird-row__photo { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; }
.bird-row__photo--placeholder { display: flex; align-items: center; justify-content: center; text-align: center; font-size: .65rem; font-weight: 600; color: var(--text-muted); background: var(--bg); border: 1px dashed var(--surface-border); padding: .25rem; }
.bird-row__info { flex: 1; min-width: 0; }
.bird-row__info p { margin: 0; }
.bird-row__band { font-weight: 700; }
.bird-row__age { font-size: .9rem; color: var(--text-muted); }
.bird-row__color { font-size: .9rem; }
.bird-row__description { font-size: .85rem; color: var(--text-muted); margin-top: .2rem !important; }
.bird-row__actions { display: flex; flex-direction: column; gap: .4rem; flex: none; }

/* ---------- Confirm dialog ---------- */
.confirm-dialog { border: 1px solid var(--surface-border); border-radius: 12px; padding: 1.25rem; background: var(--bg); color: var(--text); max-width: 320px; }
.confirm-dialog::backdrop { background: color-mix(in srgb, var(--navy) 45%, transparent); }
.confirm-dialog__text { font-weight: 700; margin: 0 0 1rem; }
.confirm-dialog__actions { display: flex; gap: .75rem; justify-content: flex-end; }

/* ---------- Settings ---------- */
.settings-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem; max-width: 480px; }
.settings-card__title { margin: 0 0 .5rem; font-size: 1.05rem; }
.settings-card__text { margin: 0 0 .9rem; color: var(--text-muted); }

/* ---------- Cloud sync (Settings section, Phase 6) ---------- */
.cloud-sync { display: flex; flex-direction: column; gap: 1rem; max-width: 420px; }
.cloud-sync__field { display: flex; flex-direction: column; gap: .4rem; }
.cloud-sync__field .field-label { font-weight: 600; font-size: .95rem; }
.cloud-sync input[type="email"] {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--surface-border);
  border-radius: 8px;
  padding: .6rem .75rem;
  min-height: 44px;
  min-width: 44px;
  line-height: 1.4;
  font-family: var(--font-body);
}
.cloud-sync__action { align-self: flex-start; min-width: 44px; }
.cloud-sync__preview, .cloud-sync__pending, .cloud-sync__last-synced { font-size: .95rem; margin: 0; }

/* ---------- Phase 2: section title ---------- */
.section-title { font-size: 1.2rem; font-weight: 800; margin: 1.75rem 0 .75rem; }

/* ---------- Phase 2: big tiles (breeding/loft landing, loft/pen grids) ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile {
  position: relative; min-height: 150px; border-radius: 14px; padding: 1.25rem;
  display: flex; flex-direction: column; justify-content: flex-end; gap: .4rem;
  background: var(--deep-blue-1); color: var(--white);
}
.tile:nth-child(even) { background: var(--deep-blue-2); }
.tile--add { background: var(--surface); border: 2px dashed var(--surface-border); color: var(--text); justify-content: center; align-items: flex-start; }
.tile--landing { border: 0; width: 100%; text-align: left; cursor: pointer; }
.tile--landing:hover, .tile:hover { outline: 2px solid var(--bright-blue); outline-offset: 2px; }
.tile__link { background: none; border: 0; color: inherit; text-align: left; width: 100%; display: flex; flex-direction: column; gap: .4rem; padding: 0; font: inherit; }
.tile__title { font-family: var(--font-heading); font-weight: 700; font-size: 1.2rem; }
.tile__meta { font-size: .9rem; color: color-mix(in srgb, var(--white) 82%, transparent); }
.tile--add .tile__meta, .tile--add .tile__title { color: color-mix(in srgb, var(--white) 82%, transparent); }
.tile__actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.tile .btn--secondary, .tile .btn--danger { background: color-mix(in srgb, var(--white) 8%, transparent); color: var(--white); border-color: color-mix(in srgb, var(--white) 40%, transparent); }
.tile--add .btn--secondary, .tile--add .btn--danger { background: var(--bg); color: var(--text); border-color: var(--surface-border); }

/* ---------- Phase 2: disclosure (expand/collapse) controls ---------- */
.disclosure__marker { position: relative; width: .9rem; height: .9rem; flex: none; }
.disclosure__marker::before, .disclosure__marker::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 2px; margin-top: -1px;
  background: currentColor; transition: transform .2s ease;
}
.disclosure__marker::after { transform: rotate(90deg); }
.disclosure__trigger[aria-expanded="true"] .disclosure__marker { transform: rotate(45deg); }
.disclosure__panel[hidden] { display: none; }
.disclosure__panel { margin-top: .6rem; }
.disclosure__form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.disclosure__form .form-message { flex-basis: 100%; }

/* ---------- Phase 2: screens, loft/pen lists ---------- */
.screen--lofts, .screen--pens, .screen--pen-detail, .screen--pairings, .screen--breeding-records, .screen--pedigree, .screen--breeding-landing { max-width: 760px; }
.bird-row__pen { font-size: .85rem; color: var(--text-muted); }
.bird-row__actions--wide { flex-direction: column; align-items: flex-end; min-width: 140px; }

/* ---------- Phase 2: pairings ---------- */
.pairing-form { display: flex; flex-direction: column; gap: 1rem; max-width: 520px; margin-bottom: 1.5rem; }
.warning-banner { background: var(--surface); border: 1px solid var(--danger); border-radius: 10px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.warning-banner__text { margin: 0; font-weight: 700; color: var(--danger); }
.warning-banner__ack { display: flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--text); }
.pairing-list__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.pairing-row { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: .9rem 1rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; align-items: center; }
.pairing-row__info p { margin: 0; }
.pairing-row__pair { font-weight: 700; }
.pairing-row__meta { font-size: .85rem; color: var(--text-muted); }
.pairing-row__end { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pairing-row__ended { margin: 0; font-size: .9rem; color: var(--text-muted); font-weight: 600; }

/* ---------- Phase 2: breeding records ---------- */
.round-form { display: flex; flex-direction: column; gap: 1rem; max-width: 520px; margin-bottom: 1rem; }
.round-list { display: flex; flex-direction: column; gap: .6rem; }
.round-row { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: .9rem 1rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; align-items: flex-start; max-width: 100%; }
.round-row__info { min-width: 0; }
.round-row__info p { margin: 0 0 .2rem; }
.round-row__pair { font-weight: 700; }
.round-row__notes { color: var(--text-muted); font-size: .9rem; }
.round-row__actions { flex: none; }
.add-young-form { display: flex; flex-direction: column; gap: .6rem; max-width: 100%; }

/* ---------- Phase 2: pedigree ----------
   A nested tree: each box's own sire/dam render inside a ".pedigree-children"
   wrapper right alongside it, so a pair always sits visually beside the child
   it belongs to (not in a flat, disconnected generation row). */
.pedigree-tree { overflow-x: auto; max-width: 100%; padding-bottom: .5rem; }
.pedigree-pair-item { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.pedigree-pair-item--root { width: 100%; }
.pedigree-children { display: flex; flex-direction: column; gap: .6rem; margin-left: 1.25rem; width: 100%; }
.pedigree-node {
  display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem .35rem .9rem;
  border-radius: 10px; border: 1px solid var(--surface-border); background: var(--surface);
  text-align: left; width: 100%;
}
.pedigree-node--plain, .pedigree-node--empty { color: var(--text-muted); padding: .7rem .9rem; flex-direction: column; align-items: flex-start; gap: .15rem; }
.pedigree-node--self { background: var(--deep-blue-1); color: var(--white); border-color: var(--deep-blue-1); }
.pedigree-node__hit {
  background: none; border: 0; color: inherit; text-align: left; flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: .15rem; padding: .35rem 0; font: inherit;
}
.pedigree-node--linked .pedigree-node__hit { cursor: pointer; }
.pedigree-node--linked:hover { outline: 2px solid var(--bright-blue); outline-offset: 2px; }
.pedigree-node__edit {
  flex: none; background: none; border: 2px solid currentColor; border-radius: 8px;
  color: inherit; font-weight: 700; font-size: .85rem; padding: .5rem .75rem; min-height: 44px;
}
.pedigree-node--self .pedigree-node__edit { border-color: color-mix(in srgb, var(--white) 55%, transparent); }
.pedigree-node__role { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .75; }
.pedigree-node__name { font-weight: 700; }
.pedigree-node__meta { font-size: .85rem; }
@media (min-width: 768px) {
  .pedigree-pair-item { flex-direction: row; align-items: center; gap: 1rem; }
  .pedigree-pair-item--root { align-items: center; }
  .pedigree-children { flex-direction: column; justify-content: center; margin-left: 1.5rem; }
  .pedigree-node { width: 230px; }
}

/* ---------- Phase 2: sire/dam picker ---------- */
.parent-field { gap: .6rem; }

/* ---------- Phase 2: breeding-records "New" badge ---------- */
.young-list { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.young-list__item { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .2rem .6rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge--new { background: var(--brand-blue); color: var(--white); }

/* ---------- Phase 2: pairings grouped-by-year list ---------- */
.pairing-list__year { font-size: 1.05rem; font-weight: 800; margin: 1.25rem 0 .5rem; color: var(--text-muted); }
.pairing-list__year:first-of-type { margin-top: .5rem; }

/* ---------- Phase 2: pen detail - move a bird in ---------- */
.move-in-field { max-width: 480px; margin-bottom: 1.25rem; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: 1rem; gap: .6rem; }

/* ---------- Phase 2: phone-width stacking for the breeding-records forms ---------- */
@media (max-width: 480px) {
  .round-form, .add-young-form { width: 100%; max-width: 100%; }
  .round-row { flex-direction: column; align-items: stretch; }
  .round-row__actions { flex: none; width: 100%; }
  .disclosure__panel { max-width: 100%; overflow-x: hidden; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-label select { width: 100%; }
}

/* ---------- Phase 3: Health section ---------- */
.screen--placeholder { max-width: 760px; }
.placeholder-note { color: var(--text-muted); margin: 0; }

/* Agenda list contract for the future Calendar view: a stacked, day-grouped
   list (not a wide grid/table) so it stays phone-friendly at any width. */
.agenda-list { display: flex; flex-direction: column; gap: 1.25rem; max-width: 760px; }
.agenda-day-group { display: flex; flex-direction: column; gap: .5rem; }
.agenda-day-heading { font-size: 1rem; font-weight: 800; margin: 0; color: var(--text); }
.agenda-item {
  display: flex; align-items: center; gap: .75rem; min-height: 44px;
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px;
  padding: .75rem 1rem; color: var(--text);
}
.agenda-item__time { flex: none; font-weight: 700; font-size: .9rem; color: var(--text-muted); }
.agenda-item__body { flex: 1; min-width: 0; }
.agenda-item__title { font-weight: 700; }
.agenda-item__meta { font-size: .85rem; color: var(--text-muted); }

@media (max-width: 768px) {
  .agenda-item { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .agenda-list { max-width: 100%; }
  .agenda-item { flex-direction: column; align-items: flex-start; gap: .3rem; }
}

/* ---------- Phase 4: Competitions (Results + Clubs) ---------- */
/* Both screens reuse .screen--breeding-records for the shared 760px max-width,
   matching viewHealthRecords.js/viewDueToday.js/viewCalendar.js/viewResults.js. */

/* Results screen: wraps the per-kind field rows for the single-bird form, and
   the per-bird rows generated for a whole-event submission. Both are plain
   stacking containers inside .round-form, matching .round-list's gap rhythm. */
.single-result-fields, .event-result-rows { display: flex; flex-direction: column; gap: 1rem; }
.results-list, .results-summary { display: flex; flex-direction: column; gap: .6rem; }
.result-row { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: .9rem 1rem; }

/* Club renewal status: colour is never the only signal - the status text
   itself ("Renewal due in...", "Renewal overdue by...") always renders too. */
.club-status--overdue { color: var(--danger); font-weight: 700; }
.club-status--due { color: var(--brand-blue); font-weight: 700; }
.club-status--unknown { color: var(--text-muted); }

/* ---------- Phase 4: treatment interval number + unit selector ----------
   Sits alongside the existing 8h/12h/24h preset chips in .chip-group; picking
   a chip sets this row back to hours and highlights the matching chip, typing
   a custom amount/unit here clears the chip highlight (see buildIntervalField
   in viewTreatments.js). */
.interval-amount-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: stretch; }
.interval-amount-row input { flex: 1 1 100px; min-width: 80px; max-width: 100%; }
.interval-amount-row select { flex: 1 1 110px; min-width: 100px; max-width: 100%; }

@media (max-width: 480px) {
  .interval-amount-row input, .interval-amount-row select { flex-basis: 100%; }
}

/* ---------- Phase 7: Pictures (approval-gated AI bird pictures) ---------- */
.screen--pictures { max-width: 760px; }
.pictures-banner {
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px;
  padding: 1rem 1.1rem; font-weight: 700; margin: 0 0 1.5rem; color: var(--text);
}
.picture-groups { display: flex; flex-direction: column; gap: 1.75rem; }
.picture-group__title { font-size: 1.1rem; font-weight: 800; margin: 0 0 .6rem; }
.picture-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.picture-card {
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px;
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem; max-width: 100%;
}
.picture-card__header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.picture-card__header p { margin: 0; }
.picture-card__bird { font-weight: 700; }
.picture-card__color { color: var(--text-muted); font-size: .9rem; }
.picture-card__prompt { width: 100%; resize: vertical; }
.picture-card__prompt--readonly {
  background: var(--bg); border: 2px solid var(--surface-border); border-radius: 8px;
  padding: .75rem .9rem; margin: 0; color: var(--text); min-height: 44px; white-space: pre-wrap;
}
.picture-card__actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.picture-card__reject { display: flex; flex-direction: column; gap: .5rem; max-width: 100%; }
.picture-card__reject-note { width: 100%; resize: vertical; }
.picture-card__approved-meta { margin: 0; font-size: .9rem; color: var(--text-muted); font-weight: 600; }
.picture-card__rejected-note {
  margin: 0; background: var(--bg); border: 2px solid var(--surface-border); border-radius: 8px;
  padding: .75rem .9rem; color: var(--text); white-space: pre-wrap;
}
.picture-card__make-btn { align-self: flex-start; min-height: 44px; }
.picture-card__make-btn[disabled] { opacity: .75; cursor: default; }

@media (max-width: 480px) {
  .screen--pictures { max-width: 100%; }
  .picture-list { max-width: 100%; }
  .picture-card { max-width: 100%; }
  .picture-card__actions { flex-direction: column; align-items: stretch; }
  .picture-card__actions .btn { width: 100%; }
}

/* ---------- Phase 7: Import screen (photo thumbnails, review cards, duplicate
   badges, step indicator) - viewImport.js owns the markup, styled generically
   here so it renders on-brand even though this screen is being built in
   parallel by another builder. ---------- */
.import-step {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  font-weight: 700; font-size: .9rem; color: var(--text-muted); margin: 0 0 1.25rem;
}
.import-step__item {
  display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .25rem;
}
.import-step__item.is-active { color: var(--brand-blue); }
.import-step__marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; border: 2px solid var(--surface-border);
  font-size: .8rem; flex: none;
}
.import-step__item.is-active .import-step__marker { border-color: var(--brand-blue); color: var(--brand-blue); }

.photo-thumb {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--surface-border); display: block; background: var(--bg);
}
.photo-thumb--placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: .8rem; font-weight: 600; color: var(--text-muted);
  border: 2px dashed var(--surface-border); border-radius: 10px; background: var(--surface);
}

.review-card {
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px;
  padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem; max-width: 100%;
}
.review-card__header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .6rem; }
.review-card__title { font-weight: 700; margin: 0; }
.review-card__meta { font-size: .85rem; color: var(--text-muted); margin: 0; }
.review-card__actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.duplicate-badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: .2rem .6rem;
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  background: transparent; border: 2px solid var(--danger); color: var(--danger);
}

@media (max-width: 480px) {
  .review-card { max-width: 100%; }
  .review-card__actions { flex-direction: column; align-items: stretch; }
  .review-card__actions .btn { width: 100%; }
}

/* Login gate (auth.js) */
.auth-screen {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--deep-blue-1); background-image: linear-gradient(180deg, var(--deep-blue-1), var(--deep-blue-2));
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--bg); color: var(--text);
  border-radius: 16px; padding: 1.75rem 1.5rem; box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column; gap: .75rem;
}
.auth-card__logo { width: 120px; height: auto; border-radius: 10px; align-self: center; margin-bottom: .25rem; }
.auth-card__title { font-size: 1.4rem; font-weight: 800; margin: 0; text-align: center; }
.auth-card__text { margin: 0; color: var(--text-muted); text-align: center; }
.auth-card__form { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.auth-card__form input { min-height: 44px; padding: .6rem .75rem; border: 2px solid var(--surface-border); border-radius: 10px; font: inherit; background: var(--bg); color: var(--text); }
.auth-card__submit { margin-top: .5rem; min-height: 48px; width: 100%; }
.auth-card__choice { min-height: 48px; width: 100%; }
.auth-card__message { min-height: 1.25rem; margin: 0; color: var(--danger, #B42318); font-weight: 600; }
.auth-card__fine { margin: .25rem 0 0; font-size: .85rem; color: var(--text-muted); text-align: center; }

/* Small fixes */
.sf-row-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.sf-delete { color: var(--danger); border-color: var(--danger); }
.sf-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(4, 30, 58, .6);
}
.sf-dialog {
  width: 100%; max-width: 440px; max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  background: var(--bg); color: var(--text); border: 1px solid var(--surface-border);
  border-radius: 14px; padding: 1.25rem; box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  display: flex; flex-direction: column; gap: .75rem;
}
.sf-dialog__title { margin: 0; font-size: 1.2rem; font-weight: 800; }
.sf-dialog__text { margin: 0; }
.sf-dialog__form { display: flex; flex-direction: column; gap: .75rem; }
.sf-dialog__actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.sf-dialog__actions:empty { display: none; }
.sf-note { font-size: .9rem; color: var(--text-muted); margin: 0; }
.sf-warning { font-size: .9rem; color: var(--text); background: var(--surface); border-left: 4px solid var(--danger); padding: .5rem .75rem; border-radius: 6px; margin: 0; }
.sf-tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--surface-border); color: var(--text); margin-left: .4rem; vertical-align: middle; }

/* Import page: the file input's intrinsic width (~363px) pushed the page sideways at 320px */
.import-label { min-width: 0; max-width: 100%; }
.import-label input[type="file"] { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; font-size: .9rem; }
.import-label input[type="file"]::file-selector-button { max-width: 100%; }
.sf-bird-name { font-weight: 600; }
.sf-search { flex: 1 1 100%; }
.sf-search input { width: 100%; box-sizing: border-box; min-height: 44px; padding: .5rem .75rem; border: 2px solid var(--surface-border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.sf-account .field { margin-bottom: .75rem; }
.sf-account input { width: 100%; box-sizing: border-box; min-height: 44px; padding: .5rem .75rem; border: 2px solid var(--surface-border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.sf-account input:disabled, .sf-account button:disabled { opacity: .6; cursor: not-allowed; }

/* Contrast: brand blue is 4.3:1 on white and 3.2:1 on navy; use readable shades for the "renewal due" text */
.round-row .club-status--due, .club-status--due { color: #0B5CC2; }
html[data-theme="dark"] .round-row .club-status--due, html[data-theme="dark"] .club-status--due { color: #6FB7FF; }

/* Genetics features */
.screen--genetics, .screen--sandbox, .screen--bird { max-width: 960px; }
.gx-ok { color: var(--text-muted); }

/* Photo + badge */
.gx-photo { display: inline-flex; flex-direction: column; gap: .25rem; position: relative; flex: none; }
.gx-photo__img { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--surface); border: 1px solid var(--surface-border); }
.gx-badge { align-self: flex-start; font-size: .72rem; font-weight: 700; line-height: 1.2; padding: .15rem .5rem; border-radius: 999px; color: var(--white); background: var(--deep-blue-1); }
.gx-badge--exact { background: #1E7B3A; }
.gx-badge--close { background: #8A5A00; }
.gx-badge--nearest { background: #6B4A9E; }
.gx-badge--impossible { background: var(--danger); color: var(--white); }
html[data-theme="dark"] .gx-badge--impossible { color: var(--navy); }
.gx-notshown { font-size: .75rem; color: var(--text-muted); line-height: 1.3; }
.gx-notshown b { font-weight: 700; }

/* Tabs */
.gx-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.gx-tab { background: var(--bg); border: 2px solid var(--surface-border); color: var(--text); border-radius: 999px; padding: .5rem 1rem; min-height: 44px; font-weight: 600; }
.gx-tab[aria-selected="true"] { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--white); }

/* Panels / layout */
.gx-two { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 900px) { .gx-two { grid-template-columns: 1fr 1fr; align-items: start; } }
.gx-panel { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; min-width: 0; display: flex; flex-direction: column; gap: .75rem; }
.gx-panel__title { margin: 0; }
.gx-panel__row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* Gene picker */
.gx-picker { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.gx-gene { display: flex; flex-direction: column; gap: .25rem; }
.gx-gene__name { font-weight: 600; font-size: .95rem; }
.gx-gene__name small { font-weight: 400; color: var(--text-muted); }
.gx-gene__slots { display: flex; gap: .5rem; flex-wrap: wrap; }
.gx-gene__select { flex: 1 1 150px; min-width: 0; max-width: 100%; }
.gx-gene__hen { color: var(--text-muted); font-size: .9rem; align-self: center; }

/* Live colour preview */
.gx-preview { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.gx-preview__photo { max-width: 100%; }
.gx-preview__text { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.gx-preview__text p { margin: 0; }
.gx-preview__name { font-weight: 800; font-size: 1.2rem; overflow-wrap: anywhere; }
.gx-preview__buttons { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Visualizer dialog */
.gx-dialog { border: 1px solid var(--surface-border); border-radius: 14px; padding: 0; background: var(--bg); color: var(--text); width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); }
.gx-dialog::backdrop { background: color-mix(in srgb, var(--navy) 55%, transparent); }
.gx-dialog__body { padding: 1.1rem; display: flex; flex-direction: column; gap: .75rem; }
.gx-dialog__title { margin: 0; }
.gx-viz__status { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 10px; padding: .75rem; min-height: 3rem; }
.gx-viz__line, .gx-viz__name { margin: 0; }
.gx-viz__name { font-weight: 800; font-size: 1.1rem; margin-top: .4rem; }
.gx-viz__list { margin: .5rem 0 0; padding-left: 1.2rem; }
.gx-viz__group { font-size: .95rem; margin: .5rem 0 .25rem; }
.gx-viz__actions { flex-wrap: wrap; margin-top: 0; }
.gx-viz__traits .chip-group { margin-bottom: .5rem; }

/* Try a pairing */
.gx-parents { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.gx-parent { display: flex; gap: .75rem; align-items: flex-start; flex: 1 1 220px; min-width: 0; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 12px; padding: .7rem; }
.gx-parent__text { min-width: 0; }
.gx-parent__text p { margin: 0; }
.gx-parent__band { font-weight: 700; }
.gx-parent__colour { overflow-wrap: anywhere; }
.gx-times { font-size: 1.5rem; font-weight: 800; color: var(--text-muted); }
.gx-warn { margin: .75rem 0; }

/* Pairings */
.gx-pairing-preview { margin-top: .5rem; }
.gx-young { margin-top: .5rem; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.gx-young__summary { display: flex; gap: .6rem; align-items: center; }
.gx-young__text { margin: 0; }
.gx-young-panel { width: 100%; }

/* Find a mate */
.gx-hero { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.gx-hero__title { margin: 0; }
.gx-ranked { margin-top: .5rem; }
.gx-row { flex-wrap: wrap; align-items: flex-start; }
.gx-row__pct { display: flex; flex-direction: column; align-items: center; min-width: 4.5rem; flex: none; }
.gx-row__pct b { font-size: 1.2rem; }
.gx-row__pct small, .gx-thumb small { color: var(--text-muted); font-size: .75rem; }
.gx-row__note { margin: .2rem 0 0; }
.gx-row__actions { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1 1 100%; }
.gx-thumbs { display: flex; gap: .6rem; flex-wrap: wrap; margin: .5rem 0; }
.gx-thumb { display: flex; flex-direction: column; gap: .15rem; max-width: 90px; }
.gx-thumb small { overflow-wrap: anywhere; }
.gx-thumb .gx-notshown, .gx-young__summary .gx-notshown { display: none; }

/* Bird page */
.gx-bird__head { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; margin: .5rem 0 1rem; }
.gx-bird__photo { width: 220px; max-width: 100%; border-radius: 12px; object-fit: cover; }
.gx-bird__photo--lib { width: auto; }
.gx-bird__facts { flex: 1 1 220px; min-width: 0; }
.gx-bird__facts p { margin: 0 0 .2rem; }
.gx-bird__title { margin: 0 0 .25rem; }
.gx-bird__name { font-size: 1.1rem; font-weight: 700; }
.gx-bird__links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.gx-bird__desc { white-space: pre-wrap; color: var(--text-muted); }
.gx-facts { display: grid; grid-template-columns: auto 1fr; gap: .15rem .9rem; margin: 0; align-items: center; }
.gx-facts dt { font-weight: 600; color: var(--text-muted); }
.gx-facts dd { margin: 0; min-width: 0; }
.bird-row__link { color: inherit; text-decoration: underline; display: inline-block; padding: .35rem 0; }

/* Pictures: finished image + progress */
.picture-card__image { display: block; width: 100%; max-width: 420px; border-radius: 10px; }
.picture-card__caption { margin: .4rem 0 0; font-size: .9rem; color: var(--text-muted); }
.picture-card__approx { margin: .25rem 0 0; font-size: .9rem; font-weight: 700; color: var(--danger); }
.picture-card__make { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.picture-card__progress { margin: 0; color: var(--text-muted); }

/* Readable links in dark mode */
html[data-theme="dark"] .btn--link, html[data-theme="dark"] .genetics-credit a { color: #6FB4FF; }

/* Layout redesign */
/* ---------- Shell: phone top bar + bottom tabs, desktop icon rail ---------- */
#app { min-height: 100vh; }
.view {
  padding: calc(var(--topbar-height) + 1rem) 1rem calc(var(--bottomnav-height) + 1.5rem + env(safe-area-inset-bottom, 0px));
  max-width: 960px; margin: 0 auto; min-width: 0;
}
#app[data-route="home"] .view { padding-top: 0; }
#app[data-route="home"] .topbar { display: none; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between;
  padding: 0 .75rem 0 1rem; background: var(--bg); border-bottom: 1px solid var(--surface-border);
}
.topbar__home { display: inline-flex; align-items: center; min-height: 44px; }
.topbar__logo { height: 32px; width: auto; display: block; }

.initials-chip {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 999px; text-decoration: none;
  font-family: var(--font-heading); font-weight: 700; font-size: .85rem; letter-spacing: .02em;
  background: color-mix(in srgb, var(--white) 14%, transparent); color: var(--white);
  border: 1px solid color-mix(in srgb, var(--white) 30%, transparent);
}
.initials-chip--topbar { background: var(--brand-blue); border-color: var(--brand-blue); }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: var(--bg); border-top: 1px solid var(--surface-border);
  height: calc(var(--bottomnav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottomnav__link {
  flex: 1 1 0; min-width: 0; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; padding: 0; font: inherit; text-decoration: none; color: var(--text-muted);
}
.bottomnav__label { font-size: 11px; font-weight: 600; line-height: 1.1; }
.bottomnav__link.is-active, .bottomnav__link[aria-expanded="true"] { color: var(--brand-blue); }
html[data-theme="dark"] .bottomnav__link.is-active, html[data-theme="dark"] .bottomnav__link[aria-expanded="true"] { color: #6FB4FF; }

.sheet-wrap { position: fixed; inset: 0; z-index: 45; }
.sheet-backdrop { position: absolute; inset: 0; background: color-mix(in srgb, var(--navy) 45%, transparent); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: calc(var(--bottomnav-height) + env(safe-area-inset-bottom, 0px));
  max-height: 75vh; overflow-y: auto; background: var(--bg); color: var(--text);
  border-radius: 18px 18px 0 0; padding: .5rem 0 .75rem; box-shadow: 0 -8px 30px rgba(4, 30, 58, .25);
}
.sheet__title { margin: .25rem 1.25rem .25rem; font-family: var(--font-heading); font-weight: 800; font-size: 1rem; }
.sheet__link {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 50px;
  padding: .5rem 1.25rem; color: var(--text); text-decoration: none; font-weight: 600; border-top: 1px solid var(--surface-border);
}
.sheet__link .icon { color: var(--text-muted); flex: none; }
.sheet__link.is-active { color: var(--brand-blue); }
html[data-theme="dark"] .sheet__link.is-active { color: #6FB4FF; }

.rail { display: none; }

/* Sub-page chip row (Breeding, Health, Shows; Birds on desktop) */
.subnav {
  display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none;
  margin: 0 -1rem 1rem; padding: 0 1rem .15rem;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav__chip {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; white-space: nowrap;
  border-radius: 999px; border: 1px solid var(--surface-border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: .9rem; text-decoration: none;
}
.subnav__chip[aria-current="page"] { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--white); }
.subnav--desktop-only { display: none; }
.subnav[hidden] { display: none; }

@media (min-width: 900px) {
  .topbar, .bottomnav, .sheet-wrap { display: none !important; }
  #app[data-route="home"] .view, .view {
    margin-left: var(--rail-width); max-width: none; padding: 1.5rem 2rem 2.5rem;
  }
  .view__body { max-width: 1200px; }
  .rail {
    display: flex; flex-direction: column; align-items: center; gap: .3rem;
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--rail-width); z-index: 50;
    background: var(--navy); padding: .75rem .4rem; overflow-y: auto;
  }
  html[data-theme="dark"] .rail { border-right: 1px solid var(--surface-border); }
  .rail__logo {
    display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
    border-radius: 12px; background: var(--brand-blue); color: var(--white); text-decoration: none;
    font-family: var(--font-heading); font-weight: 800; font-size: 1rem; margin-bottom: .6rem;
  }
  .rail__link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: none;
    width: 64px; min-height: 56px; border-radius: 12px; text-decoration: none;
    color: color-mix(in srgb, var(--white) 80%, transparent);
  }
  .rail__label { font-size: 11px; font-weight: 600; line-height: 1.1; }
  .rail__link:hover { background: color-mix(in srgb, var(--white) 8%, transparent); color: var(--white); }
  .rail__link.is-active { background: var(--deep-blue-1); color: var(--white); }
  .rail__spacer { flex: 1 1 auto; min-height: .5rem; }
  .initials-chip--rail { margin-top: .4rem; }
  .subnav { margin: 0 0 1.25rem; padding: 0; flex-wrap: wrap; overflow: visible; }
  .subnav--desktop-only { display: flex; }
  .subnav--desktop-only[hidden] { display: none; }
}

/* ---------- Shared bits: cards, chips, tiles ---------- */
a.btn:not(.btn--link) { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.card-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.list-card {
  display: flex; align-items: center; gap: .85rem; min-width: 0; min-height: 64px;
  background: var(--bg); color: var(--text); text-decoration: none;
  border: 1px solid var(--surface-border); border-radius: 16px; padding: .7rem .8rem;
  box-shadow: 0 1px 2px rgba(4, 30, 58, .05);
}
a.list-card:hover { border-color: var(--brand-blue); }
.list-card__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.list-card__body p { margin: 0; }
.list-card__title { font-weight: 700; overflow-wrap: anywhere; }
.list-card__meta { font-size: .85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.list-card__aside { flex: none; font-size: .85rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.list-card__chev { flex: none; color: var(--text-muted); }

.empty-card { list-style: none; background: var(--bg); border: 1px dashed var(--surface-border); border-radius: 16px; padding: 1rem 1.1rem; }
.empty-card__title { margin: 0; font-weight: 700; }
.empty-card__text { margin: .25rem 0 0; color: var(--text-muted); font-size: .92rem; }
.empty-card .btn { margin-top: .75rem; }

.mini-chip-row { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.mini-chip {
  display: inline-flex; align-items: center; font-size: .72rem; font-weight: 600; line-height: 1.3;
  padding: .12rem .5rem; border-radius: 999px; background: var(--surface); color: var(--text); border: 1px solid var(--surface-border);
}
.mini-chip--blue { color: #0B5CC2; border-color: color-mix(in srgb, var(--brand-blue) 35%, transparent); background: color-mix(in srgb, var(--brand-blue) 9%, var(--bg)); }
.mini-chip--alert { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.mini-chip--ok { color: #1E7B3A; border-color: color-mix(in srgb, #1E7B3A 35%, transparent); }
.mini-chip--muted { color: var(--text-muted); }
.mini-chip--warn { color: #8A5A00; border-color: color-mix(in srgb, #8A5A00 40%, transparent); }
html[data-theme="dark"] .mini-chip--blue { color: #6FB7FF; }
html[data-theme="dark"] .mini-chip--ok { color: #6FD08C; }
html[data-theme="dark"] .mini-chip--warn { color: #FFC266; }

.bird-tile {
  position: relative; display: inline-block; flex: none; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--surface-border);
}
.bird-tile__img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 13px; }
.bird-tile--empty { background: linear-gradient(135deg, var(--surface), var(--surface-border)); }
.bird-tile--ring-cock { outline: 3px solid var(--brand-blue); outline-offset: 3px; }
.bird-tile--ring-hen { outline: 3px solid #B3267A; outline-offset: 3px; }
html[data-theme="dark"] .bird-tile--ring-hen { outline-color: #E05BA8; }
.sex-badge {
  position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; line-height: 1;
  color: var(--white); background: var(--brand-blue); border: 2px solid var(--bg);
}
.sex-badge--hen { background: #B3267A; }

.pill-btn {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 1.1rem; flex: none;
  border-radius: 999px; border: 0; background: var(--brand-blue); color: var(--white);
  font-family: var(--font-body); font-weight: 700; text-decoration: none;
}
.pill-btn:hover { background: var(--deep-blue-1); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.list-head .page-title { margin: 0; }

.filter-chip {
  flex: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 1rem; white-space: nowrap;
  border-radius: 999px; border: 1.5px solid var(--surface-border); background: var(--bg); color: var(--text);
  font-weight: 600; font-size: .9rem;
}
.filter-chip[aria-pressed="true"], .filter-chip[aria-expanded="true"] { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--white); }
.filter-chip__count { font-weight: 700; opacity: .85; }
.filter-chip--small { font-size: .85rem; padding: 0 .85rem; }
.chip-scroll { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem .5rem; padding: 0 1rem .2rem; }
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: .5rem; }

.group-label { font-family: var(--font-body); font-size: .74rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); margin: 1.25rem 0 .5rem; }

.info-card { background: var(--bg); border: 1px solid var(--surface-border); border-radius: 16px; padding: 1rem; min-width: 0; }
.info-card__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .4rem; }
.info-card__head .info-card__title { margin: 0; }
.info-card__title { font-size: 1rem; font-weight: 800; margin: 0 0 .6rem; }
.info-card__text { color: var(--text-muted); margin: 0 0 .6rem; }
.info-card__actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.tab-stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.tab-row { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--surface-border); margin: 0 0 1rem; }
.tab-row::-webkit-scrollbar { display: none; }
.tab-row__tab {
  flex: none; background: none; border: 0; border-bottom: 3px solid transparent; min-height: 48px; padding: 0 1rem;
  font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.tab-row__tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--bright-blue); }
.tab-panel:focus { outline: none; }

.phone-only { display: block; }
.desktop-only { display: none; }
@media (min-width: 900px) {
  .phone-only { display: none; }
  .desktop-only { display: block; }
  .chip-scroll { margin: 0 0 .5rem; padding: 0 0 .2rem; flex-wrap: wrap; }
}

/* ---------- Home ---------- */
.screen--home { max-width: none; }
.home-hero {
  background: var(--navy); color: var(--white);
  margin: 0 -1rem; padding: calc(.75rem + env(safe-area-inset-top, 0px)) 1rem 1.25rem;
}
html[data-theme="dark"] .home-hero { background: var(--deep-blue-2); }
.home-hero__top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.home-hero__app { font-family: var(--font-heading); font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; }
.home-hero__day { color: var(--white); font-size: 2rem; margin: .9rem 0 .2rem; }
.home-hero__sub { margin: 0; color: color-mix(in srgb, var(--white) 84%, transparent); font-size: .92rem; overflow-wrap: anywhere; }
.home-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: 1.1rem; }
.home-stats--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-stat {
  display: flex; flex-direction: column; justify-content: space-between; gap: .2rem; min-height: 76px; min-width: 0;
  background: var(--deep-blue-1); color: var(--white); border-radius: 14px; padding: .7rem .8rem; text-decoration: none;
}
.home-stat:hover { outline: 2px solid var(--bright-blue); outline-offset: 2px; }
.home-stat__value { font-family: var(--font-heading); font-weight: 800; font-size: 1.6rem; line-height: 1; }
.home-stat__label { font-size: .8rem; font-weight: 600; color: color-mix(in srgb, var(--white) 86%, transparent); }
.home-stat--alert .home-stat__value { color: #8FD6FF; }
.home-body { background: var(--surface); margin: 0 -1rem; padding: 1.25rem 1rem 1rem; display: flex; flex-direction: column; gap: 1.5rem; }
.home-section__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.home-section__title { margin: 0; font-size: 1.1rem; font-weight: 800; }
.home-section__link { display: inline-flex; align-items: center; gap: .15rem; min-height: 44px; color: #0B5CC2; font-weight: 600; text-decoration: none; }
html[data-theme="dark"] .home-section__link { color: #6FB4FF; }
.check-btn {
  flex: none; width: 44px; height: 44px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--brand-blue); border: 2px solid var(--brand-blue);
}
html[data-theme="dark"] .check-btn { color: #6FB4FF; border-color: #6FB4FF; }
.check-btn:hover, .check-btn.is-done { background: var(--brand-blue); color: var(--white); border-color: var(--brand-blue); }
.due-card.is-done { opacity: .6; }
.pair-card__tiles { display: inline-flex; align-items: center; gap: .25rem; flex: none; }
.pair-card__x { font-weight: 800; color: var(--text-muted); }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.quick-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; min-height: 92px; padding: .9rem; min-width: 0;
  background: var(--bg); color: var(--text); border: 1px solid var(--surface-border); border-radius: 16px;
  font-family: var(--font-heading); font-weight: 700; text-decoration: none;
}
.quick-btn:hover { border-color: var(--brand-blue); }
.quick-btn__icon {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--brand-blue) 12%, transparent); color: var(--brand-blue);
}
html[data-theme="dark"] .quick-btn__icon { color: #6FB4FF; }
@media (min-width: 900px) {
  .home-hero { margin: 0; border-radius: 20px; padding: 1.25rem 1.5rem 1.5rem; }
  .home-stats { max-width: 640px; }
  .home-body { margin: 1rem 0 0; border-radius: 20px; padding: 1.5rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; align-items: start; }
  .home-body > .home-section:last-child { grid-column: 1 / -1; }
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Birds list ---------- */
.search-field { position: relative; margin: 0 0 .75rem; }
.search-field__icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-field__input {
  width: 100%; min-height: 44px; padding: .55rem .75rem .55rem 2.5rem; border-radius: 12px;
  border: 2px solid var(--surface-border); background: var(--bg); color: var(--text);
}
.bird-card__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; }
.bird-card__band { font-weight: 700; overflow-wrap: anywhere; }
.bird-card__name { color: var(--text-muted); font-size: .9rem; }
.bird-card .bird-tile { margin: 0 6px 6px 0; }
.pen-group:first-child .group-label { margin-top: .75rem; }

.bird-split__detail[hidden] { display: none; }
.bird-split--desktop { display: flex; align-items: flex-start; gap: 0; max-width: none; }
.bird-split--desktop .bird-split__list { flex: 1 1 420px; min-width: 0; background: var(--bg); border-right: 1px solid var(--surface-border); padding-right: 1.5rem; }
.bird-split--desktop .bird-split__detail {
  flex: 1 1 380px; min-width: 0; padding-left: 1.5rem; position: sticky; top: 1.5rem;
  max-height: calc(100vh - 3rem); overflow-y: auto;
}
.bird-table-wrap { overflow-x: auto; }
.bird-table { width: 100%; border-collapse: collapse; }
.bird-table th { text-align: left; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding: .4rem .5rem; border-bottom: 1px solid var(--surface-border); }
.bird-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--surface-border); vertical-align: middle; font-size: .92rem; }
.bird-table__photo { width: 56px; }
.bird-table__row { cursor: pointer; }
.bird-table__row:hover { background: var(--surface); }
.bird-table__row.is-selected { background: color-mix(in srgb, var(--brand-blue) 10%, var(--bg)); box-shadow: inset 3px 0 0 var(--brand-blue); }
.bird-table__select {
  display: flex; flex-direction: column; align-items: flex-start; gap: .05rem; width: 100%; min-height: 44px;
  background: none; border: 0; padding: .2rem 0; text-align: left; color: var(--text);
}
.bird-table__sub { font-size: .8rem; color: var(--text-muted); }
.bird-table .mini-chip-row { margin-top: 0; }

/* ---------- Bird page ---------- */
.screen--bird { max-width: 760px; }
.bird-hdr { background: var(--navy); color: var(--white); margin: -1rem -1rem 0; padding: .35rem 1rem 1.25rem; }
html[data-theme="dark"] .bird-hdr { background: var(--deep-blue-2); }
.bird-hdr__bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.hdr-back { display: inline-flex; align-items: center; gap: .2rem; min-height: 44px; color: var(--white); text-decoration: none; font-weight: 600; }
.bird-hdr__actions { display: flex; align-items: center; gap: .4rem; }
.hdr-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0;
  border-radius: 12px; background: color-mix(in srgb, var(--white) 10%, transparent); color: var(--white);
  border: 1px solid color-mix(in srgb, var(--white) 25%, transparent); text-decoration: none; font-weight: 600;
}
.hdr-btn--text { padding: 0 1rem; }
.bird-hdr__main { display: flex; align-items: center; gap: 1rem; margin-top: .6rem; min-width: 0; }
.bird-hdr__main .bird-tile { border-color: color-mix(in srgb, var(--white) 25%, transparent); }
.bird-hdr__main .sex-badge { border-color: var(--navy); }
.bird-hdr__text { min-width: 0; }
.bird-hdr__band { color: var(--white); font-size: 1.6rem; margin: 0; overflow-wrap: anywhere; }
.bird-hdr__sub { margin: .2rem 0 0; color: color-mix(in srgb, var(--white) 84%, transparent); }
.bird-hdr__chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
.hdr-chip {
  font-size: .78rem; font-weight: 600; padding: .18rem .6rem; border-radius: 999px;
  background: color-mix(in srgb, var(--white) 12%, transparent); color: var(--white); border: 1px solid color-mix(in srgb, var(--white) 22%, transparent);
}
.hdr-chip--warn { background: #8A5A00; border-color: #8A5A00; }
.screen--bird .tab-row { margin: 0 -1rem 1rem; padding: 0 .5rem; }
.bird-hdr--panel { margin: 0 0 1rem; border-radius: 16px; padding: 1rem; }
.bird-hdr--panel .bird-hdr__main { margin-top: 0; }
.bird-hdr--panel .bird-hdr__band { font-size: 1.35rem; }
.panel-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.panel-actions .btn--secondary { color: var(--white); border-color: color-mix(in srgb, var(--white) 40%, transparent); }

.action-menu-wrap { position: relative; }
.action-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px;
  display: flex; flex-direction: column; padding: .35rem; border-radius: 14px;
  background: var(--bg); color: var(--text); border: 1px solid var(--surface-border); box-shadow: 0 12px 30px rgba(4, 30, 58, .25);
}
.action-menu[hidden] { display: none; }
.action-menu__item { background: none; border: 0; text-align: left; padding: .65rem .9rem; min-height: 44px; border-radius: 10px; font-weight: 600; color: var(--text); }
.action-menu__item:hover, .action-menu__item:focus-visible { background: var(--surface); }
.action-menu__item--danger { color: var(--danger); }

.genes-say__row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.genes-say__text { flex: 1 1 140px; min-width: 0; }
.genes-say__name { margin: 0; font-weight: 800; font-size: 1.15rem; overflow-wrap: anywhere; }
.genes-say__match { margin: .25rem 0 0; font-size: .9rem; font-weight: 600; }
.genes-say__match.is-ok { color: #1E7B3A; }
.genes-say__match.is-diff { color: #8A5A00; }
html[data-theme="dark"] .genes-say__match.is-ok { color: #6FD08C; }
html[data-theme="dark"] .genes-say__match.is-diff { color: #FFC266; }
.genes-say .gx-notshown { display: none; }
.now-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.now-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--surface-border); }
.now-row:first-child { border-top: 0; padding-top: 0; }
.now-row__text { flex: 1 1 auto; min-width: 0; }
.now-row__title { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.now-row__meta { margin: 0; font-size: .85rem; color: var(--text-muted); }
.family-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.family-tile {
  display: flex; align-items: center; gap: .6rem; min-height: 56px; min-width: 0; padding: .5rem;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--surface-border); color: var(--text); text-decoration: none;
}
a.family-tile:hover { border-color: var(--brand-blue); }
.family-tile__text { display: flex; flex-direction: column; min-width: 0; }
.family-tile__role { font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.family-tile__band { font-weight: 700; overflow-wrap: anywhere; }
.family-tile--empty .family-tile__band { color: var(--text-muted); font-weight: 600; }
.big-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.big-btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 56px; padding: .5rem .75rem; text-align: center;
  border-radius: 14px; border: 1.5px solid var(--surface-border); background: var(--bg); color: var(--text);
  font-weight: 700; text-decoration: none; font-size: .95rem;
}
.big-btn--primary { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--white); }
.big-btn:hover { border-color: var(--brand-blue); }
.bird-add-dialog { width: min(520px, calc(100vw - 2rem)); max-width: none; max-height: calc(100vh - 2rem); }

/* ---------- Pairings ---------- */
.screen--pairings { max-width: 1100px; }
.new-pairing { margin-bottom: 1.25rem; }
.new-pairing .pairing-form { margin-bottom: 0; }
.pair-items { gap: .75rem; }
.pair-item { background: var(--bg); border: 1px solid var(--surface-border); border-radius: 16px; padding: .75rem; min-width: 0; }
.pair-item--ended .pair-item__summary { opacity: .75; }
.pair-item__summary { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem; }
.pair-item__summary .list-card__body { flex: 1 1 150px; }
.pair-open { flex: none; }
.pair-detail { margin-top: .75rem; padding-top: .9rem; border-top: 1px solid var(--surface-border); }
.pair-top { margin-bottom: .75rem; }
.pair-parents { display: flex; align-items: flex-start; justify-content: center; gap: .5rem; }
.pair-parent { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6px; }
.pair-parent__band { margin: .7rem 0 0; font-weight: 700; overflow-wrap: anywhere; }
.pair-parent__meta { margin: 0; font-size: .85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.pair-parents__x { font-size: 1.6rem; font-weight: 800; color: var(--text-muted); align-self: center; margin-top: -1.5rem; }
.round-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.round-tile { display: flex; flex-direction: column; gap: .1rem; background: var(--surface); border-radius: 12px; padding: .6rem; min-width: 0; }
.round-tile__value { font-weight: 800; overflow-wrap: anywhere; }
.round-tile__label { font-size: .75rem; color: var(--text-muted); font-weight: 600; }
.round-card .info-card__text { margin: .6rem 0 0; }
.whatif-more { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: .75rem; }
.whatif-more[hidden] { display: none; }
.whatif-note { margin: .5rem 0 0; }
.whatif-note:empty { display: none; }
@media (min-width: 720px) { .whatif-more { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) {
  .pair-top { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: center; }
}

/* ---------- Expected young: Sons / Daughters result cards ---------- */
.sex-toggle { display: inline-flex; gap: 2px; padding: 3px; border: 1.5px solid var(--surface-border); border-radius: 999px; margin: 0 0 .75rem; }
.sex-toggle__btn { background: none; border: 0; border-radius: 999px; min-height: 44px; padding: 0 1.2rem; font-weight: 600; color: var(--text-muted); }
.sex-toggle__btn[aria-pressed="true"] { background: var(--brand-blue); color: var(--white); }
.gx-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1.5rem; }
.gx-col { min-width: 0; }
.gx-col__title { display: none; margin: 0 0 .6rem; }
.gx-outcomes[data-show="cock"] .gx-col[data-sex="hen"], .gx-outcomes[data-show="hen"] .gx-col[data-sex="cock"] { display: none; }
.result-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.result-card { display: flex; flex-direction: column; min-width: 0; background: var(--bg); border: 1px solid var(--surface-border); border-radius: 14px; overflow: hidden; }
.result-card__photo { position: relative; height: 110px; background: var(--surface); overflow: hidden; }
.result-card__photo .gx-photo { display: block; width: 100% !important; height: 100%; }
.result-card__photo .gx-photo__img { width: 100%; height: 110px; object-fit: cover; border: 0; border-radius: 0; }
.result-card__photo .gx-badge { position: absolute; top: 6px; left: 6px; }
.result-card__photo .gx-notshown { display: none; }
.result-card__body { display: flex; flex-direction: column; gap: .35rem; padding: .6rem .7rem .75rem; flex: 1 1 auto; align-items: stretch; }
.result-card__name { margin: 0; font-weight: 700; font-size: .95rem; overflow-wrap: anywhere; }
.chance-bar { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--surface-border) 70%, transparent); overflow: hidden; }
.chance-bar__fill { display: block; height: 100%; background: var(--brand-blue); border-radius: inherit; }
.result-card__chance { margin: 0; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.result-card__viz { align-self: flex-start; margin-top: auto; }
@media (min-width: 900px) {
  .sex-toggle { display: none; }
  .gx-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gx-col__title { display: block; }
  .gx-outcomes .gx-col[data-sex] { display: block !important; }
}

/* Treatments: log vs plan switch */
.treat-kind { display: flex; gap: .5rem; flex-wrap: wrap; margin: .75rem 0 .25rem; }
