/* ==========================================================================
   BeepEquinos — design system
   Dark-first. Dourado da marca (#CAA44E) como único acento. Tipografia:
   Fraunces (display/números) + Inter (interface). Nada de hex em templates:
   toda cor sai de um token daqui.
   ========================================================================== */

:root {
  --gold: #caa44e;
  --gold-2: #e2c06a;
  --gold-3: #8e6f2a;
  --gold-soft: rgba(202, 164, 78, 0.14);
  --gold-line: rgba(202, 164, 78, 0.35);

  --bg: #0e0d0b;
  --bg-2: #151311;
  --bg-3: #1d1a16;
  --bg-4: #26221c;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f2ecdf;
  --muted: #a69e8e;
  --faint: #6f695e;
  --on-gold: #17130b;

  --ok: #5fb27a;
  --ok-soft: rgba(95, 178, 122, 0.16);
  --warn: #e0952f;
  --warn-soft: rgba(224, 149, 47, 0.16);
  --danger: #d9605b;
  --danger-soft: rgba(217, 96, 91, 0.16);
  --info: #6c9fd8;
  --info-soft: rgba(108, 159, 216, 0.16);

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --radius: 12px;
  --radius-lg: 18px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --gutter: 16px;
  --content-max: 1240px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --gold: #a8842e;
  --gold-2: #caa44e;
  --gold-3: #7c5f1b;
  --gold-soft: rgba(168, 132, 46, 0.12);
  --gold-line: rgba(168, 132, 46, 0.35);
  --bg: #f6f2ea;
  --bg-2: #ffffff;
  --bg-3: #fbf8f1;
  --bg-4: #f0ebe0;
  --line: rgba(30, 26, 18, 0.1);
  --line-2: rgba(30, 26, 18, 0.18);
  --text: #1c1913;
  --muted: #6c655a;
  --faint: #9a9285;
  --on-gold: #ffffff;
  --shadow: 0 10px 30px rgba(30, 26, 18, 0.08);
  --shadow-sm: 0 1px 2px rgba(30, 26, 18, 0.08);
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--gold-2); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 0.75rem; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold); color: var(--on-gold); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Tipografia ---------- */
.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; font-variation-settings: "opsz" 144; }
.h1 { font-size: clamp(1.7rem, 2.6vw, 2.25rem); }
.h2 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
.h3 { font-size: 1.05rem; font-weight: 600; }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gold); font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.num { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "cv11" 1; }
.mono { font-variant-numeric: tabular-nums; }
.gold { color: var(--gold); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .danger { color: var(--danger); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 6px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.sidebar .brand img { width: 34px; height: 34px; }
.sidebar .brand b { font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }
.sidebar .brand small { display: block; color: var(--faint); font-size: 0.68rem; letter-spacing: 0.04em; }
.nav-section { margin-top: 10px; padding: 0 10px 6px; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 0.92rem; transition: background 0.15s, color 0.15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--bg-3); color: var(--text); }
.nav a.active { background: var(--gold-soft); color: var(--gold-2); }
.sidebar .spacer { flex: 1; }
.org-switch { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); }
.org-switch .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.org-switch select { background: transparent; border: 0; width: 100%; color: var(--text); font-weight: 500; }
.org-switch select option { color: #111; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 38px; }
.topbar .search input { background: transparent; border: 0; width: 100%; outline: 0; }
.topbar .search svg { width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 2; }
.topbar .grow { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-2); font-weight: 600; font-size: 0.8rem; border: 1px solid var(--gold-line); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.content { padding: 22px var(--gutter) 40px; width: 100%; max-width: var(--content-max); margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

.tabbar { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 0.66rem; font-weight: 500; }
  .tabbar a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.active { color: var(--gold-2); }
  .content { padding-bottom: calc(var(--tabbar-h) + 28px); }
  .topbar .search { max-width: none; }
  .hide-mobile { display: none !important; }
}
@media (min-width: 901px) { .hide-desktop { display: none !important; } }

/* Menu "Mais" (mobile) */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.55); display: none; }
.sheet.open { display: block; }
.sheet .panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--bg-2); border-radius: 18px 18px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); max-height: 80dvh; overflow-y: auto; }
.sheet .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet .grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 12px; background: var(--bg-3); color: var(--muted); font-size: 0.78rem; text-align: center; }
.sheet .grid a svg { width: 22px; height: 22px; stroke: var(--gold); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 12px; }

/* ---------- Componentes ---------- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card .card-head h3 { font-size: 0.95rem; display: flex; align-items: center; gap: 6px; }
.card .card-head h3 svg, h3 svg { width: 16px; height: 16px; stroke: var(--gold); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card.pad-0 .card-head { padding: 14px 16px 0; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } .grid.cols-4.keep-2, .grid.cols-2.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.gap-6 { gap: 6px; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }

.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: auto -30px -40px auto; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(closest-side, var(--gold-soft), transparent); pointer-events: none; }
.stat .label { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.02em; }
.stat .value { font-family: var(--font-ui); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.stat .hint { font-size: 0.78rem; color: var(--faint); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text); font-weight: 500; font-size: 0.9rem; cursor: pointer;
  white-space: nowrap; transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg-4); color: var(--text); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold); color: var(--on-gold); border-color: transparent; }
.btn.primary:hover { background: var(--gold-2); color: var(--on-gold); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg-3); color: var(--text); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 0.82rem; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em; background: var(--bg-4); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.gold { background: var(--gold-soft); color: var(--gold-2); border-color: var(--gold-line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.93rem; }
.table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 600; }
.table tbody tr:hover { background: var(--bg-3); }
.table tr:last-child td { border-bottom: 0; }
.table td.num { text-align: right; font-family: var(--font-ui); font-weight: 600; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; white-space: nowrap; letter-spacing: -0.01em; }
.table th.num { text-align: right; }
.table a.strong { font-weight: 600; }
.table .cell-sub { display: block; font-size: 0.78rem; color: var(--faint); }

.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.list .item .main { flex: 1; min-width: 0; }
.list .item .title { font-weight: 500; }
.list .item .meta { font-size: 0.8rem; color: var(--faint); }
.list .item .aside { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .display { color: var(--text); font-size: 1.3rem; margin-bottom: 6px; }
.empty svg { width: 42px; height: 42px; stroke: var(--gold); fill: none; stroke-width: 1.4; margin: 0 auto 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 12px; color: var(--muted); font-weight: 500; font-size: 0.9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--gold-2); border-color: var(--gold); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { background: var(--gold-soft); color: var(--gold-2); border-color: var(--gold-line); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 0.92rem; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 8px; } }

/* ---------- Formulários ---------- */
.form { display: grid; gap: 16px; }
.form .fields { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form .fields { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.field .help { font-size: 0.76rem; color: var(--faint); }
.field .error { font-size: 0.78rem; color: var(--danger); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line-2); color: var(--text); outline: 0; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; padding: 10px 12px; min-height: 84px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select[multiple] { height: auto; padding: 8px; background-image: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); }
:root[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }
input[type="file"] { padding: 8px 12px; height: auto; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--gold); }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.check label { font-size: 0.92rem; color: var(--text); font-weight: 400; }
.radios { display: flex; gap: 6px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-3); cursor: pointer; font-size: 0.9rem; }
.radios label:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-2); }
.radios input { margin: 0; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-3); cursor: pointer; font-size: 0.9rem; }
.checklist label:has(input:checked) { border-color: var(--gold-line); background: var(--gold-soft); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 6px; }
.form-actions .left { margin-right: auto; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 0.82rem; }
.alert { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-3); font-size: 0.9rem; }
.alert.error { border-color: var(--danger-soft); background: var(--danger-soft); color: var(--danger); }
.alert.ok { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.alert.warn { border-color: transparent; background: var(--warn-soft); color: var(--warn); }
.alert.gold { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-2); }
.money-input { position: relative; }
.money-input::before { content: "R$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); font-size: 0.85rem; }
.money-input input { padding-left: 38px; }

/* Toasts (mensagens) */
.toasts { position: fixed; top: 14px; right: 14px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 420px); }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 0.9rem; animation: toast-in 0.25s ease-out; display: flex; gap: 10px; align-items: flex-start; }
.toast.success { border-color: var(--ok); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warn); }
.toast.info { border-color: var(--gold-line); }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .stat .value { font-size: 1.4rem; } }
@media (max-width: 640px) { .toasts { left: 14px; right: 14px; top: 10px; max-width: none; } }

/* ---------- Animal ---------- */
.animal-card { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); transition: border-color 0.15s, transform 0.12s; }
.animal-card:hover { border-color: var(--gold-line); transform: translateY(-1px); color: inherit; }
.animal-card .photo { width: 64px; height: 64px; border-radius: 12px; background: var(--bg-4); overflow: hidden; flex: none; display: grid; place-items: center; }
.animal-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.animal-card .photo svg { width: 28px; height: 28px; stroke: var(--gold-3); fill: none; stroke-width: 1.4; }
.animal-card .name { font-weight: 600; font-size: 1rem; }
.animal-card .meta { font-size: 0.8rem; color: var(--faint); }
.animal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.hero-animal { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.hero-animal .photo { aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--bg-3); border: 1px solid var(--line); display: grid; place-items: center; }
.hero-animal .photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-animal .photo svg { width: 64px; height: 64px; stroke: var(--gold-3); fill: none; stroke-width: 1.2; }
@media (max-width: 720px) { .hero-animal { grid-template-columns: 1fr; } .hero-animal .photo { max-width: 200px; } }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-grid figure { margin: 0; border-radius: 12px; overflow: hidden; background: var(--bg-3); border: 1px solid var(--line); }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-grid figcaption { padding: 8px; font-size: 0.75rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.pedigree { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 0.85rem; }
.pedigree .node { padding: 8px 10px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); }
.pedigree .node small { display: block; color: var(--faint); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; }
.pedigree .node.ext { border-style: dashed; }
@media (max-width: 640px) { .pedigree { grid-template-columns: 1fr; } }

/* ---------- Gráfico de barras (CSS puro) ---------- */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; height: 150px; padding-top: 10px; }
.bars .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .bar i { display: block; width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--gold-2), var(--gold-3)); min-height: 3px; transition: height 0.4s ease; }
.bars .bar.pale i { background: var(--bg-4); }
.bars .bar span { font-size: 0.68rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.bars .bar b { font-size: 0.72rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }

/* ---------- Rateio ---------- */
.alloc-table td input { height: 36px; max-width: 140px; }
.alloc-table tr.off { opacity: 0.45; }
.alloc-total { display: flex; justify-content: space-between; padding: 12px 14px; background: var(--bg-3); border-radius: 10px; font-weight: 500; }

/* ---------- Auth / público ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .stage { position: relative; overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.auth .stage::before { content: ""; position: absolute; width: 640px; height: 640px; border-radius: 50%; right: -240px; top: -200px; background: radial-gradient(closest-side, rgba(202, 164, 78, 0.22), transparent); }
.auth .stage img.mark { width: 240px; opacity: 0.95; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4)); }
.auth .stage .tagline { font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; max-width: 480px; }
.auth .panel { display: grid; place-items: center; padding: 40px var(--gutter); }
.auth .panel form, .auth .panel .box { width: 100%; max-width: 380px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth .stage { min-height: 200px; padding: 28px var(--gutter); } .auth .stage img.mark { width: 120px; } .auth .stage .tagline { font-size: 1.3rem; } }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); }
.pagination .current { background: var(--gold-soft); color: var(--gold-2); border-color: var(--gold-line); }

.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.timeline .tl { position: relative; padding: 6px 0 14px; }
.timeline .tl::before { content: ""; position: absolute; left: -16px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.timeline .tl .when { font-size: 0.75rem; color: var(--faint); }

.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; font-size: 2.2rem; letter-spacing: 0.3em; text-align: center; padding: 18px; background: var(--bg-3); border: 1px dashed var(--gold-line); border-radius: 14px; color: var(--gold-2); }
kbd, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--bg-4); padding: 2px 6px; border-radius: 6px; }
.dl-inline { display: inline-flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); }
.dl-inline b { color: var(--text); font-weight: 500; }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + 8px); z-index: 5; }
@media (min-width: 901px) { .sticky-actions { position: static; } }

/* ---------- Galeria: álbuns, mídia, upload, lightbox ---------- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.album-card { display: block; border-radius: 16px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); transition: border-color 0.15s, transform 0.12s; }
.album-card:hover { border-color: var(--gold-line); transform: translateY(-2px); color: inherit; }
.album-card .cover { aspect-ratio: 4 / 3; background: var(--bg-4); display: grid; place-items: center; overflow: hidden; }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.album-card .cover svg { width: 32px; height: 32px; stroke: var(--gold-3); fill: none; stroke-width: 1.4; }
.album-card .info { padding: 10px 12px; }
.album-card .title { font-weight: 600; }
.album-card .meta { font-size: 0.76rem; color: var(--faint); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 640px) { .media-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; } }
.media-item { margin: 0; border-radius: 12px; overflow: visible; background: var(--bg-3); border: 1px solid var(--line); }
.media-item .thumb { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: var(--bg-4); cursor: zoom-in; overflow: hidden; border-radius: 12px 12px 0 0; }
.media-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s; }
.media-item .thumb:hover img { transform: scale(1.04); }
.media-item .thumb .ph { display: grid; place-items: center; width: 100%; height: 100%; }
.media-item .thumb .ph svg { width: 34px; height: 34px; stroke: var(--gold-3); fill: var(--gold-3); stroke-width: 1; }
.media-item.video .thumb { cursor: pointer; }
.badge-video, .badge-cover { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 600; background: rgba(0, 0, 0, 0.65); color: #fff; backdrop-filter: blur(6px); }
.badge-cover { left: auto; right: 8px; bottom: auto; top: 8px; background: var(--gold); color: var(--on-gold); }
.media-item figcaption { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; font-size: 0.72rem; color: var(--muted); }
.media-menu { position: relative; }
.media-menu summary { list-style: none; cursor: pointer; padding: 0 6px; border-radius: 6px; color: var(--muted); font-weight: 700; }
.media-menu summary::-webkit-details-marker { display: none; }
.media-menu summary:hover { background: var(--bg-4); color: var(--text); }
.media-menu .menu { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 220px; padding: 8px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.media-menu .menu form { margin: 0; }
.media-menu .menu button, .media-menu .menu a { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; color: var(--text); font-size: 0.85rem; cursor: pointer; }
.media-menu .menu button:hover, .media-menu .menu a:hover { background: var(--bg-3); }
.media-menu .menu button.danger { color: var(--danger); }
.media-menu .menu button.btn.primary { background: var(--gold); color: var(--on-gold); text-align: center; font-weight: 600; }
.media-menu .menu select, .media-menu .menu input[type="text"] { height: 34px; font-size: 0.82rem; }
.media-menu .menu .row { padding: 4px 6px; }

.upload-panel .dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 26px 16px; border: 1.5px dashed var(--gold-line); border-radius: 14px; background: var(--gold-soft); cursor: pointer; text-align: center; transition: border-color 0.15s, background 0.15s; }
.upload-panel .dropzone:hover, .upload-panel .dropzone.over { border-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 70%, var(--gold) 12%); }
.upload-panel .dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-panel .dz-text { font-size: 0.9rem; color: var(--muted); }
.upload-panel .dz-text b { color: var(--gold-2); }

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.94); display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox .lb-stage { width: 100%; height: 100%; display: grid; place-items: center; min-height: 0; }
.lightbox .lb-stage img, .lightbox .lb-stage video { max-width: 100%; max-height: calc(100dvh - 90px); border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.lightbox .lb-caption { color: rgba(255, 255, 255, 0.75); font-size: 0.85rem; padding: 10px 0 4px; text-align: center; min-height: 28px; }
.lightbox .lb-close { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 24px; cursor: pointer; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 28px; cursor: pointer; }
.lightbox .lb-nav:hover, .lightbox .lb-close:hover { background: var(--gold); color: var(--on-gold); }
.lightbox .lb-prev { left: 14px; } .lightbox .lb-next { right: 14px; }
@media (max-width: 640px) { .lightbox .lb-nav { width: 38px; height: 38px; font-size: 22px; } }

/* ---------- Genealogia em 3 gerações (pais · avós · bisavós) ---------- */
.pedigree3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(44px, auto); gap: 6px 10px; }
.pedigree3 .node { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--bg-3); border: 1px solid var(--line); min-width: 0; }
.pedigree3 .node.gen1 { border-color: var(--gold-line); background: var(--gold-soft); }
.pedigree3 .node.ext { border-style: dashed; }
.pedigree3 .node.empty { opacity: 0.55; }
.pedigree3 .node small { color: var(--faint); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; }
.pedigree3 .node a { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.pedigree3 .node .reg { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .pedigree3 { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .pedigree3 .node { grid-column: auto !important; grid-row: auto !important; }
  .pedigree3 .node.gen2 { margin-left: 14px; }
  .pedigree3 .node.gen3 { margin-left: 28px; }
}

/* ---------- Financeiro mês a mês (estilo planilha) ---------- */
.month-chips .chip { font-variant-numeric: tabular-nums; }
.ledger-grid { grid-template-columns: minmax(0, 3fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 1180px) { .ledger-grid { grid-template-columns: 1fr; } }
.quick-entry .quick-row { display: grid; grid-template-columns: 150px minmax(180px, 2fr) minmax(150px, 1fr) 150px 130px minmax(140px, 1.4fr) auto; gap: 10px; align-items: end; }
.quick-entry .field.grow { min-width: 0; }
@media (max-width: 1100px) { .quick-entry .quick-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .quick-entry .quick-row { grid-template-columns: 1fr 1fr; } .quick-entry .field.grow { grid-column: 1 / -1; } }
.table.ledger tbody tr.paid td { color: var(--muted); }
.table.ledger tbody tr.paid td a.strong { color: var(--text); }
.table.ledger tfoot td { border-top: 2px solid var(--line-2); padding-top: 12px; }
.badge-btn { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; border: 1px solid transparent; cursor: pointer; background: var(--bg-4); color: var(--muted); }
.badge-btn.ok { background: var(--ok-soft); color: var(--ok); }
.badge-btn.warn { background: var(--warn-soft); color: var(--warn); }
.badge-btn.danger { background: var(--danger-soft); color: var(--danger); }
.badge-btn.info { background: var(--info-soft); color: var(--info); }
.badge-btn:hover { filter: brightness(1.15); }
.table.matrix th, .table.matrix td { padding: 8px 8px; font-size: 0.82rem; }
.strong { font-weight: 600; }

/* ---------- Manejo diário ---------- */
.quick-entry .quick-row.task-row { grid-template-columns: 140px minmax(200px, 2fr) 150px minmax(150px, 1fr) minmax(150px, 1fr) 110px auto; }
@media (max-width: 1400px) { .quick-entry .quick-row.task-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .quick-entry .quick-row.task-row { grid-template-columns: 1fr 1fr; } }
.task-item .check-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--gold-line); background: transparent; color: var(--on-gold); cursor: pointer; font-weight: 700; flex: none; }
.task-item .check-btn.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-item.done .title { text-decoration: line-through; color: var(--muted); }
