:root {
  --green-950: #160e0a;
  --green-900: #2b1710;
  --green-800: #70251d;
  --green-100: #f2e4c9;
  --gold-600: #9b681f;
  --gold-500: #d3aa50;
  --gold-100: #f6e5b9;
  --cream: #f4ecdf;
  --paper: #fffbf3;
  --ink: #251710;
  --muted: #77695d;
  --line: #ddcdb3;
  --danger: #941f1f;
  --shadow: 0 12px 36px rgba(48, 25, 14, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.offline-banner { position: fixed; inset: 0 0 auto 0; z-index: 100; padding: 7px 12px; text-align: center; color: #fff7e4; background: #7b261f; font-size: .82rem; }
.offline-banner:not([hidden]) + .app-shell { padding-top: 32px; }
.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: #fff8e9; background: radial-gradient(circle at 50% 8%, rgba(194,132,43,.19), transparent 25%), linear-gradient(165deg, var(--green-950), #35170f 72%, #491c16); padding: 22px 18px 28px; z-index: 20; }
.brand { display: flex; justify-content: center; align-items: center; padding: 0 4px 20px; }
.brand-logo { display: block; width: min(176px, 100%); max-height: 176px; object-fit: contain; filter: drop-shadow(0 9px 15px rgba(0,0,0,.32)); }
.brand-mark { display: grid; place-items: center; width: 46px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; color: #ffe2a1; font-family: Georgia, serif; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 1.15rem; color: #fff0c4; }
.brand span { font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; opacity: .72; }
.main-nav { display: grid; gap: 6px; }
.nav-button { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; padding: 13px 14px; color: rgba(255,255,255,.74); background: transparent; text-align: left; font-weight: 650; }
.nav-button span { width: 24px; font-size: 1.25rem; text-align: center; }
.nav-button:hover, .nav-button.active { color: #fff; background: rgba(255,255,255,.12); }
.nav-button.active { box-shadow: inset 3px 0 var(--gold-500); }
.sidebar-status { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.13); }
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { font-size: .82rem; }
.sidebar-status small { margin-top: 2px; color: rgba(255,255,255,.55); font-size: .7rem; }
.connection-dot { width: 9px; height: 9px; border-radius: 50%; background: #dfaa4a; box-shadow: 0 0 0 4px rgba(223,170,74,.15); }
.connection-dot.online { background: #d3aa50; box-shadow: 0 0 0 4px rgba(211,170,80,.18); }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px; min-height: 76px; padding: 12px clamp(18px, 4vw, 52px); border-bottom: 1px solid rgba(72,40,24,.12); background: rgba(244,236,223,.94); backdrop-filter: blur(12px); }
.topbar-title { margin-right: auto; }
.topbar-title span, .topbar-title small { display: block; }
.topbar-title span { font-weight: 800; color: var(--green-900); }
.topbar-title small { color: var(--muted); font-size: .75rem; }
.icon-button.menu-button { display: none; }
.subview-menu-button { display: none; }
main { width: min(1480px, 100%); margin: 0 auto; padding: clamp(22px, 4vw, 52px); }
.view { display: none; animation: reveal .2s ease; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }

h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; color: var(--green-950); }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; }
h2 { margin-bottom: 6px; font-size: 1.45rem; }
.eyebrow { margin-bottom: 7px; color: var(--gold-600); font-size: .72rem; font-weight: 850; letter-spacing: .17em; }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 165px; align-items: center; min-height: 215px; border: 1px solid rgba(211,170,80,.26); border-radius: 20px; padding: clamp(24px, 3vw, 36px); color: rgba(255,245,222,.82); background: radial-gradient(circle at 89% 22%, rgba(211,170,80,.3), transparent 29%), linear-gradient(135deg, #1a100c 0%, #3b1a12 58%, #70251d 100%); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -100px; bottom: -190px; width: 390px; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
.hero h1 { max-width: 720px; margin-bottom: 7px; color: #fff0c7; font-size: clamp(2.05rem, 3.3vw, 3.35rem); line-height: .98; text-shadow: 0 2px 14px rgba(0,0,0,.28); }
.hero p:not(.eyebrow) { max-width: 720px; margin-bottom: 0; font-size: .95rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.hero .button { padding: 9px 14px; }
.hero-emblem { z-index: 1; display: grid; place-items: center; width: 138px; aspect-ratio: 1; justify-self: end; border: 1px solid rgba(224,181,93,.28); border-radius: 50%; color: #e8bb65; font-size: 4rem; background: rgba(0,0,0,.18); transform: rotate(-5deg); }
.hero-emblem img { width: 116%; height: 116%; object-fit: contain; transform: rotate(5deg); filter: drop-shadow(0 7px 12px rgba(0,0,0,.45)); }

.button { border: 1px solid transparent; border-radius: 10px; padding: 11px 17px; font-weight: 750; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--green-800); }
.button-primary:hover { background: var(--green-900); }
.button-secondary { border-color: var(--line); color: var(--green-900); background: #fff; }
.button-danger { color: #fff; background: var(--danger); }
.button-danger:hover { background: #741717; }
.button-gold { color: #26150d; background: linear-gradient(180deg, #efd17f, #c99438); box-shadow: inset 0 1px rgba(255,255,255,.38); }
.button-ghost-light { border-color: rgba(255,255,255,.3); color: #fff; background: rgba(255,255,255,.05); }
.compact { padding: 8px 12px; font-size: .84rem; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 9px; color: var(--green-900); background: transparent; font-size: 1.45rem; }
.icon-button:hover { background: var(--green-100); }
.text-button { border: 0; padding: 5px; color: var(--green-800); background: transparent; font-weight: 750; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 22px 0; }
.stat-card { padding: 20px; border: 1px solid rgba(88,51,30,.1); border-radius: 16px; background: var(--paper); box-shadow: 0 6px 24px rgba(48,25,14,.06); }
.stat-card .stat-value { display: block; margin: 8px 0 2px; color: var(--green-950); font-family: Georgia, serif; font-size: 2rem; font-weight: 800; }
.stat-card small { color: var(--muted); }
.stat-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--gold-600); background: var(--gold-100); }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { border: 1px solid rgba(88,51,30,.11); border-radius: 18px; padding: clamp(18px, 3vw, 26px); background: var(--paper); box-shadow: 0 8px 26px rgba(48,25,14,.06); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.panel-heading p:last-child { color: var(--muted); }
.compact-list { display: grid; gap: 4px; min-height: 110px; }
.compact-item { display: flex; align-items: center; gap: 12px; padding: 11px 5px; border-bottom: 1px solid #ecece6; }
.compact-item:last-child { border-bottom: 0; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; border-radius: 50%; color: var(--green-900); background: var(--green-100); font-weight: 850; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.compact-info { min-width: 0; flex: 1; }
.compact-info strong, .compact-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-info small { margin-top: 2px; color: var(--muted); }
.line-panel { margin-top: 20px; }
.line-chart { display: grid; gap: 12px; }
.line-row { display: grid; grid-template-columns: minmax(90px, 170px) 1fr 36px; align-items: center; gap: 10px; }
.line-bar { overflow: hidden; height: 10px; border-radius: 8px; background: #ecece5; }
.line-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-800), var(--gold-500)); }
.empty-state:empty { place-items: center; color: var(--muted); }
.empty-state:empty::after { content: "Aún no hay registros"; }

.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.page-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.bird-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.bird-stat-card { display: flex; align-items: center; gap: 14px; min-height: 92px; border: 1px solid rgba(88,51,30,.11); border-radius: 15px; padding: 16px 18px; color: inherit; background: linear-gradient(145deg, #fffdf8, #f4ead8); box-shadow: 0 6px 20px rgba(48,25,14,.055); text-align: left; transition: .16s ease; }
.bird-stat-card:hover { border-color: var(--gold-500); transform: translateY(-2px); box-shadow: 0 9px 24px rgba(48,25,14,.1); }
.bird-stat-card.selected { border-color: #2d8152; background: linear-gradient(145deg, #f7fff9, #e0f4e5); box-shadow: 0 0 0 3px rgba(45,129,82,.12); }
.bird-stat-icon { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; color: #145b35; background: #d8f3df; font-size: 1.35rem; font-weight: 850; }
.bird-stat-card strong, .bird-stat-card small { display: block; }
.bird-stat-card strong { color: var(--green-950); font-family: Georgia, serif; font-size: 1.75rem; line-height: 1; }
.bird-stat-card small { margin-top: 5px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; padding: 14px; border: 1px solid rgba(88,51,30,.11); border-radius: 15px; background: rgba(255,251,243,.78); }
.toolbar select, .search-box { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.toolbar select { padding: 0 34px 0 12px; }
.search-box { display: flex; align-items: center; gap: 8px; flex: 1 1 280px; padding: 0 12px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 16px; }
.entity-card { overflow: hidden; border: 1px solid rgba(88,51,30,.11); border-radius: 16px; background: var(--paper); box-shadow: 0 6px 20px rgba(48,25,14,.055); }
.bird-card-summary { display: grid; grid-template-columns: minmax(145px, 42%) minmax(0, 1fr); gap: 0; min-height: 175px; background: linear-gradient(145deg, #ead8b8, #fff0cc); }
.bird-list-photo { display: grid; place-items: center; min-width: 0; overflow: hidden; color: var(--green-800); background: #140d09; font-family: Georgia, serif; font-size: clamp(1.25rem, 3vw, 2.3rem); font-weight: 800; text-align: center; }
.bird-list-photo img { width: 100%; height: 100%; object-fit: contain; }
.bird-list-photo span { max-width: calc(100% - 18px); overflow-wrap: anywhere; }
.bird-card-overview { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 18px; }
.bird-card-overview h3 { margin-bottom: 6px; color: var(--green-950); font-size: clamp(1.35rem, 3vw, 2rem); overflow-wrap: anywhere; }
.bird-card-overview p { margin-bottom: 6px; color: var(--muted); font-size: .84rem; }
.bird-card-overview > small { color: #694737; }
.bird-card-status-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.bird-card-status-actions .icon-action { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 9px; color: var(--green-800); background: rgba(255,255,255,.72); }
.bird-card-status-actions .icon-action svg { width: 18px; height: 18px; fill: currentColor; }
.bird-photo { position: relative; display: grid; place-items: center; height: 175px; color: var(--green-800); background: linear-gradient(145deg, #ead8b8, #fff0cc); font-family: Georgia, serif; font-size: 3.5rem; font-weight: 800; }
.bird-photo img { width: 100%; height: 100%; object-fit: cover; }
.bird-photo > span:not(.status-pill) { max-width: calc(100% - 28px); font-size: clamp(1.4rem, 4vw, 2.6rem); overflow-wrap: anywhere; word-break: break-word; text-align: center; }
.bird-photo .status-pill { position: absolute; top: 12px; right: 12px; }
.card-body { padding: 17px; }
.card-title-row { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.card-title-row > div { min-width: 0; flex: 1; }
.card-title-row h3 { margin-bottom: 4px; color: var(--green-950); font-size: 1.15rem; overflow-wrap: anywhere; word-break: break-word; }
.card-title-row > span { flex: 0 1 auto; max-width: 42%; overflow-wrap: anywhere; text-align: right; }
.card-title-row p { color: var(--muted); font-size: .82rem; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.meta-grid small, .meta-grid strong { display: block; }
.meta-grid small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.meta-grid strong { margin-top: 3px; font-size: .86rem; }
.card-actions { display: flex; gap: 7px; padding-top: 12px; border-top: 1px solid #ecece5; }
.card-actions button { flex: 1; border: 0; border-radius: 8px; padding: 8px; color: var(--green-800); background: var(--green-100); font-size: .78rem; font-weight: 750; }
.card-actions button.icon-action { flex: 0 0 38px; display: grid; place-items: center; padding: 8px; }
.card-actions button.icon-action svg { width: 18px; height: 18px; fill: currentColor; }
.card-actions button.danger { flex: 0 0 38px; color: var(--danger); background: #f8e8e6; }
.status-pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 5px 9px; color: #664312; background: #f3e1af; font-size: .68rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.status-pill.activo, .status-pill.activa { color: #145b35; background: #d8f3df; }
.status-pill.vendido, .status-pill.vendida, .status-pill.cerrado { color: #785915; background: #f8df91; }
.status-pill.baja { color: #963c34; background: #f8dfdc; }
.status-pill.neutral { color: #66594d; background: #eee4d5; }
.bird-detail-status-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 54px; margin: -8px 0 18px; }
.bird-detail-status-row::before { content: ""; }
.bird-detail-status { padding: 10px 22px; font-size: 1rem; }
.bird-detail-actions { display: flex; justify-self: end; align-items: center; gap: 8px; }
.bird-detail-edit { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 11px; color: var(--green-800); background: var(--green-100); }
.bird-detail-edit:hover { color: #fff; background: var(--green-800); }
.bird-detail-edit svg { width: 21px; height: 21px; fill: currentColor; }
.bird-detail-delete { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 11px; color: var(--danger); background: #f8dfdc; }
.bird-detail-delete:hover { color: #fff; background: var(--danger); }
.bird-detail-delete svg { width: 21px; height: 21px; fill: currentColor; }
.change-status-button { min-height: 44px; border: 1px solid #d9c7a3; border-radius: 11px; padding: 8px 13px; color: #672e22; background: #f5e6c8; font-size: .78rem; font-weight: 800; }
.change-status-button:hover { border-color: var(--gold-500); background: #eed8ac; }
.lot-header { padding: 20px; color: #fff; background: linear-gradient(135deg, var(--green-900), var(--green-800)); }
.lot-header .status-pill { float: right; }
.lot-header h3 { margin: 18px 0 4px; color: #fff; font-size: 1.45rem; }
.lot-header p { margin: 0; color: rgba(255,255,255,.7); }
.parent-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 4px 0 16px; padding: 12px; border-radius: 10px; background: var(--cream); }
.parent-pair div { text-align: center; }
.parent-pair small, .parent-pair strong { display: block; }
.parent-pair small { color: var(--muted); }
.parent-pair span { color: var(--gold-600); font-size: 1.2rem; }

.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-panel label { display: grid; gap: 6px; color: #4e372a; font-size: .82rem; font-weight: 700; }
.settings-panel > label { margin-bottom: 13px; }
.settings-panel input, .settings-panel select, .settings-panel textarea, .modal input, .modal select, .modal textarea { width: 100%; border: 1px solid #d6c2a1; border-radius: 9px; padding: 10px 11px; color: var(--ink); background: #fffdf8; outline: none; }
.settings-panel input:focus, .modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--green-800); box-shadow: 0 0 0 3px rgba(112,37,29,.11); }
.check-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.check-row input { width: auto; }
.form-grid { display: grid; gap: 14px; }
.two-cols { grid-template-columns: 1fr 1fr; }
.three-cols { grid-template-columns: repeat(3, 1fr); }
.span-two { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }
.radio-field { min-width: 0; margin: 0; border: 0; padding: 0; }
.radio-field > legend { margin-bottom: 6px; padding: 0; color: #4e372a; font-size: .82rem; font-weight: 700; }
.radio-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-choice { display: flex !important; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 1px solid #d6c2a1; border-radius: 9px; padding: 8px 10px; color: var(--green-900); background: #fffdf8; cursor: pointer; }
.radio-choice:has(input:checked) { border-color: var(--green-800); background: var(--green-100); box-shadow: 0 0 0 2px rgba(112,37,29,.09); }
.modal .radio-choice input { width: auto; accent-color: var(--green-800); }
.bird-form-layout { display: grid; gap: 14px; }
.bird-form-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
.bird-form-row.two-columns { grid-template-columns: 1fr 1fr; }
.bird-form-layout label, .bird-form-row > label { display: grid; gap: 6px; color: #4e372a; font-size: .82rem; font-weight: 700; }
.sex-card { border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px 16px; background: linear-gradient(145deg, #fffaf0, #f6e8ce); }
.sex-card > legend { padding: 0 7px; color: var(--green-900); font-family: Georgia, serif; font-size: 1rem; font-weight: 800; }
.sex-card .radio-options { max-width: 430px; }
.calculated-age { display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 4px 10px; min-height: 67px; border: 1px solid #d6c2a1; border-radius: 10px; padding: 10px 13px; background: var(--gold-100); }
.calculated-age > span { color: #4e372a; font-size: .82rem; font-weight: 700; }
.calculated-age output { color: var(--green-900); font-family: Georgia, serif; font-size: 1.1rem; font-weight: 800; }
.calculated-age small { grid-column: 1 / -1; color: var(--muted); }
.bird-secondary-row { margin-top: 2px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-actions, .modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.backup-card { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: var(--ink); background: #fff; text-align: left; }
.backup-card:hover { border-color: var(--gold-500); background: #fffdf5; }
.backup-icon { grid-row: span 2; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; color: var(--green-900); background: var(--green-100); font-weight: 900; }
.backup-card small { color: var(--muted); }
.audit-panel { grid-column: 1 / -1; }
.audit-list { max-height: 360px; overflow: auto; }
.audit-item { display: grid; grid-template-columns: 150px 1fr auto; gap: 14px; padding: 11px 0; border-bottom: 1px solid #ecece5; font-size: .84rem; }
.audit-item time, .audit-item span:last-child { color: var(--muted); }

.modal { width: min(920px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow: auto; border: 0; border-radius: 20px; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.modal::backdrop { background: rgba(5,28,21,.72); backdrop-filter: blur(3px); }
.modal form, .detail-modal > div { padding: clamp(20px, 4vw, 34px); }
.modal-header { display: flex; justify-content: space-between; align-items: start; gap: 15px; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.8rem; }
.modal-header-actions { display: flex; align-items: center; gap: 4px; }
.editor-delete-button { color: var(--danger); background: #f8dfdc; }
.editor-delete-button:hover { color: #fff; background: var(--danger); }
.editor-delete-button svg { width: 20px; height: 20px; fill: currentColor; }
.subsection { margin: 22px 0 0; border: 1px solid var(--line); border-radius: 12px; padding: 15px; }
.subsection legend { padding: 0 7px; color: var(--green-900); font-weight: 800; }
.field-help { color: var(--muted); font-size: .78rem; }
.photo-section { position: relative; }
.parent-card { display: grid; gap: 13px; margin: 0; border: 1px solid #d9c7a3; border-radius: 14px; padding: 15px; background: linear-gradient(145deg, #fffdf8, #f7eddd); box-shadow: 0 7px 18px rgba(61,36,19,.06); }
.parent-card legend { padding: 0 8px; color: var(--green-900); font-family: Georgia, serif; font-size: 1.05rem; font-weight: 800; }
.parent-card label { display: grid; gap: 6px; color: #4e372a; font-size: .82rem; font-weight: 700; }
.bird-status-editor { margin: 0; border: 1px solid #d9c7a3; border-radius: 14px; padding: 13px; background: #fffdf8; }
.bird-status-editor legend { padding: 0 7px; color: #4e372a; font-size: .82rem; font-weight: 800; }
.bird-status-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.bird-status-choice { display: block !important; cursor: pointer; }
.bird-status-choice input { position: absolute; opacity: 0; pointer-events: none; }
.bird-status-choice span { display: grid; place-items: center; min-height: 45px; border: 2px solid transparent; border-radius: 10px; font-size: .82rem; font-weight: 850; }
.bird-status-choice.activo span { color: #145b35; background: #d8f3df; }
.bird-status-choice.vendido span { color: #785915; background: #f8df91; }
.bird-status-choice.baja span { color: #963c34; background: #f8dfdc; }
.bird-status-choice input:checked + span { border-color: currentColor; box-shadow: 0 0 0 3px rgba(43,23,16,.09); }
.bird-status-choice input:focus-visible + span { outline: 3px solid rgba(190,129,40,.32); outline-offset: 2px; }
.photo-boxes { display: grid; grid-template-columns: repeat(4, minmax(105px, 1fr)); gap: 12px; margin-top: 14px; }
.photo-box-wrap { position: relative; min-width: 0; }
.photo-box { position: relative; display: grid; place-items: center; align-content: center; gap: 7px; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border: 2px dashed #c8ad7e; border-radius: 13px; padding: 8px; color: var(--green-800); background: linear-gradient(145deg, #f6ead5, #fff7e8); text-align: center; }
.photo-box:hover { border-color: var(--gold-500); background: #fffaf0; }
.photo-box.filled { border-style: solid; border-color: #d5c29e; padding: 0; }
.photo-box img { width: 100%; height: 100%; object-fit: contain; background: #140d09; }
.photo-box-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; background: var(--green-800); font-size: 1.35rem; }
.photo-box strong { font-size: .82rem; }
.photo-box small { color: var(--muted); font-size: .7rem; }
.remove-photo { position: absolute; z-index: 2; top: 6px; right: 6px; display: grid; place-items: center; width: 27px; height: 27px; border: 2px solid #fff; border-radius: 50%; color: #fff; background: rgba(88,26,21,.86); font-size: 1rem; }
.more-photo-button { margin-top: 12px; }
.photo-source-modal { position: fixed; z-index: 400; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(5,28,21,.72); backdrop-filter: blur(3px); }
.photo-source-card { width: min(520px, 100%); border-radius: 18px; padding: 24px; background: var(--paper); box-shadow: 0 30px 90px rgba(0,0,0,.32); }
.confirmation-card { width: min(470px, 100%); }
.confirmation-card > p { color: var(--muted); line-height: 1.55; }
.photo-source-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-source-button { display: grid; justify-items: center; gap: 5px; min-height: 145px; border: 1px solid var(--line); border-radius: 14px; padding: 20px 12px; color: var(--green-900); background: #fff; }
.photo-source-button:hover { border-color: var(--gold-500); background: #fffaf0; }
.photo-source-button > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #fff; background: var(--green-800); font-size: 1.25rem; }
.photo-source-button strong { font-size: 1rem; }
.photo-source-button small { color: var(--muted); }
.camera-error-panel { margin-top: 14px; border-left: 4px solid var(--danger); border-radius: 9px; padding: 13px 15px; color: #762f29; background: #fbe7e5; }
.camera-error-panel strong { display: block; margin-bottom: 4px; }
.camera-error-panel p { margin-bottom: 12px; font-size: .84rem; }
.notes-after-photos, .catalog-card > label { display: grid; gap: 6px; margin-top: 16px; color: #4e372a; font-size: .82rem; font-weight: 700; }
.catalog-card .form-errors { margin-top: 12px; margin-bottom: 0; }
.health-entry { display: grid; grid-template-columns: 150px 1fr 1.5fr auto; gap: 8px; }
.health-list { display: grid; gap: 6px; margin-top: 10px; }
.health-row { display: grid; grid-template-columns: 95px 1fr 1.5fr auto; gap: 8px; align-items: center; padding: 8px; border-radius: 8px; background: var(--cream); font-size: .8rem; }
.health-row button { border: 0; color: var(--danger); background: transparent; }
.form-errors { margin-bottom: 15px; border-left: 4px solid var(--danger); border-radius: 7px; padding: 11px 14px; color: #7c2c26; background: #fbe7e5; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bird-detail-fields { display: grid; gap: 12px; }
.detail-grid.detail-row-one { grid-template-columns: 1fr; }
.detail-grid.detail-row-two { grid-template-columns: repeat(2, 1fr); }
.detail-grid.detail-row-three { grid-template-columns: repeat(3, 1fr); }
.detail-field { border-radius: 10px; padding: 12px; background: var(--cream); }
.detail-field small, .detail-field strong { display: block; }
.detail-field small { color: var(--muted); }
.detail-photos { display: grid; grid-template-columns: repeat(4, minmax(105px, 1fr)); gap: 12px; margin: 16px 0; }
.detail-photo-box { cursor: zoom-in; }
.detail-photo-box img { width: 100%; height: 100%; border-radius: inherit; object-fit: contain; }
.status-change-modal { width: min(620px, calc(100vw - 28px)); }
.status-change-options { margin-top: 8px; }
.delete-confirmation-modal { width: min(540px, calc(100vw - 28px)); }
.delete-warning { display: flex; align-items: flex-start; gap: 13px; border-left: 4px solid var(--danger); border-radius: 10px; padding: 15px; color: #762f29; background: #fbe7e5; }
.delete-warning > span { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--danger); font-weight: 900; }
.delete-warning strong { display: block; margin-bottom: 4px; }
.delete-warning p { margin: 0; line-height: 1.45; }
.photo-preview-dialog { width: min(1100px, calc(100vw - 28px)); }
.photo-preview-stage { display: grid; place-items: center; min-height: 260px; border-radius: 15px; padding: 12px; background: #140d09; }
.photo-preview-stage img { display: block; max-width: 100%; max-height: calc(100vh - 235px); object-fit: contain; }
.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 9px; width: min(370px, calc(100vw - 40px)); }
.toast { border-left: 4px solid var(--gold-500); border-radius: 10px; padding: 13px 15px; color: #fff; background: var(--green-950); box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.error { border-left-color: #ee6d61; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .control-grid { grid-template-columns: 1fr; }
  .audit-panel { grid-column: auto; }
  .three-cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 15px 0 50px rgba(0,0,0,.24); }
  .sidebar.open { transform: translateX(0); }
  .icon-button.menu-button { display: grid; }
  .subview-menu-button:not([hidden]) { position: fixed; z-index: 18; top: 12px; left: 12px; display: grid; color: #fff6e4; background: var(--green-900); box-shadow: 0 5px 18px rgba(0,0,0,.2); }
  #subview-menu-button:not([hidden]) + main { padding-top: 66px; }
  .topbar { min-height: 66px; padding: 10px 15px; }
  .topbar .button { font-size: 0; }
  .topbar .button::first-letter { font-size: 1rem; }
  main { padding: 20px 14px 40px; }
  .hero { grid-template-columns: 1fr; min-height: 275px; padding: 23px 20px; }
  .hero h1 { max-width: 90%; font-size: clamp(2rem, 10vw, 2.75rem); }
  .hero-emblem { position: absolute; right: -18px; bottom: -22px; width: 108px; opacity: .38; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 15px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: start; }
  .bird-stats-grid { grid-template-columns: 1fr 1fr; }
  .bird-stat-card:first-child { grid-column: 1 / -1; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: 1 / -1; }
  .cards-grid { grid-template-columns: 1fr; }
  .two-cols, .three-cols { grid-template-columns: 1fr; }
  .bird-form-row.two-columns { grid-template-columns: 1fr; }
  .span-two, .span-full { grid-column: auto; }
  .health-entry { grid-template-columns: 1fr; }
  .health-row { grid-template-columns: 1fr auto; }
  .health-row span:nth-child(3) { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid.detail-row-one { grid-template-columns: 1fr; }
  .detail-grid.detail-row-two { grid-template-columns: repeat(2, 1fr); }
  .detail-grid.detail-row-three { grid-template-columns: repeat(2, 1fr); }
  .photo-boxes { grid-template-columns: 1fr 1fr; }
  .audit-item { grid-template-columns: 1fr; gap: 3px; }
}

@media (max-width: 430px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .backup-actions, .toolbar { grid-template-columns: 1fr; }
  .search-box { grid-column: auto; }
  .page-heading { display: grid; }
  .page-heading .button { width: 100%; }
  .bird-stats-grid { grid-template-columns: 1fr; }
  .bird-stat-card:first-child { grid-column: auto; }
  .detail-grid, .detail-grid.detail-row-one, .detail-grid.detail-row-two, .detail-grid.detail-row-three { grid-template-columns: 1fr; }
  .bird-detail-status-row { grid-template-columns: auto 1fr; gap: 10px; }
  .bird-detail-status-row::before { display: none; }
  .bird-detail-actions { justify-self: end; }
  .change-status-button { max-width: 90px; }
  .bird-card-summary { grid-template-columns: 120px minmax(0, 1fr); min-height: 155px; }
  .bird-card-overview { padding: 13px; }
  .photo-source-actions { grid-template-columns: 1fr; }
  .bird-status-options { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .topbar, .toolbar, .button, .card-actions { display: none !important; }
  .app-shell { display: block; }
  main { padding: 0; }
  .entity-card, .panel { break-inside: avoid; box-shadow: none; }
}
