/* ==========================================================================
   Stanley Farm and Ranch v2 · Public herd SPA
   Scoped under .herd-app so site chrome / footer keep /css/site.css.
   Palette: dark pine/dirt, cream type, gold #c9a24a.
   ========================================================================== */

/* ==========================================================================
   Stanley Farm and Ranch · Public Herd Page
   Theme matched to stanleyfarmandranch.com Elementor kit-361:
   light page bg (#EEF6F9 / #F5F5F7), white cards, dark teal text (#002D33),
   green CTAs (#30CB65), gold accents (#FDD61F), dark teal header (#00161B).
   ========================================================================== */

.herd-app {
  /* Ranch palette — dark pine/dirt, cream text, gold #c9a24a */
  --bg-deep: #14110e;
  --bg: #1c1814;
  --bg-elev: #252019;
  --bg-elev-2: #2c2620;
  --bg-hover: #312a22;
  --border: rgba(201, 162, 74, 0.28);
  --border-strong: rgba(201, 162, 74, 0.45);
  --border-subtle: rgba(244, 234, 216, 0.1);

  --text: #f4ead8;
  --text-muted: #c4b8a4;
  --text-dim: #8d8273;

  --gold: #c9a24a;
  --gold-soft: #a8863c;
  --gold-bright: #e0be6a;
  --gold-glow: rgba(201, 162, 74, 0.35);
  --gold-dim: rgba(201, 162, 74, 0.18);

  --green: #7d9b6a;
  --green-dim: rgba(125, 155, 106, 0.18);
  --red: #c45c3e;
  --red-dim: rgba(196, 92, 62, 0.16);
  --blue: #6e8faf;
  --blue-dim: rgba(110, 143, 175, 0.16);
  --purple: #9b7ec8;
  --purple-dim: rgba(155, 126, 200, 0.16);
  --orange: #d4a574;
  --orange-dim: rgba(212, 165, 116, 0.18);
  --teal: #6aa89a;
  --teal-dim: rgba(106, 168, 154, 0.16);

  --header-bg: #14110e;
  --header-bg-2: #1c1814;
  --header-text: #f4ead8;
  --header-muted: rgba(244, 234, 216, 0.72);

  --radius: 14px;
  --radius-lg: 16px;
  --radius-xl: 18px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.45);
  --glass: #252019;
  --blur: none;

  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --serif: "Oswald", "Arial Narrow", sans-serif;
  --display: "Oswald", "Arial Narrow", sans-serif;

  --topbar-h: 4.25rem;
  --drawer-w: min(440px, 100vw);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1180px;

  --sp-BOV: #c9a24a;
  --sp-CAP: #7d9b6a;
  --sp-OVI: #6e8faf;
  --sp-AVI: #d4a574;
  --sp-EQU: #9b7ec8;
  --sp-SUI: #c45c3e;
  --sp-CAM: #6aa89a;
  --sp-TUR: #a08060;

  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}


/* Reset / base */
.herd-app *, .herd-app *::before, .herd-app *::after { box-sizing: border-box; }
.herd-app {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 1.5rem);
  color-scheme: light;
  background: var(--bg-deep);
}
.herd-app {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Kill browser white form-control chrome on dark UI */
.herd-app button, .herd-app input, .herd-app select, .herd-app textarea {
  font: inherit;
  color: inherit;
  color-scheme: light;
  appearance: none;
  -webkit-appearance: none;
}
.herd-app button {
  background: transparent;
  border: none;
  cursor: pointer;
}
.herd-app a { color: var(--gold); text-decoration: none; }
.herd-app a:hover { color: var(--gold-bright); }
.herd-app img, .herd-app svg { display: block; max-width: 100%; }
.herd-app ul, .herd-app ol { margin: 0; padding: 0; list-style: none; }
.herd-app h1, .herd-app h2, .herd-app h3, .herd-app p { margin: 0; }
.herd-app .hidden { display: none !important; }

/* Ambient background */
.herd-app .app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(253, 195, 0, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 0%, rgba(49, 203, 101, 0.05), transparent 50%),
    var(--bg-deep);
  pointer-events: none;
}

/* Topbar — solid black like SFR main site header */
.herd-app .topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--topbar-h);
  height: auto;
  border-bottom: 1px solid rgba(253, 195, 0, 0.15);
  background: #000000;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.herd-app .topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: auto;
  min-height: 4.25rem;
  padding: 0.45rem 1.5rem 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1.25rem;
}
.herd-app .brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
  flex-shrink: 0;
  color: inherit;
  text-decoration: none;
}
.herd-app .brand:hover { color: inherit; }
.herd-app .brand:hover .brand-title { color: var(--gold-bright); }
.herd-app .brand-mark {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(253, 195, 0, 0.5);
  box-shadow:
    0 0 0 2px rgba(253, 195, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 0 20px var(--gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.herd-app .brand-mark-lg {
  width: 56px;
  height: 56px;
}
.herd-app .brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 3px;
}
.herd-app .brand-text { display: flex; flex-direction: column; min-width: 0; gap: 0.05rem; }
.herd-app .brand-kicker {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold, #e8c36a);
}
.herd-app .brand-title {
  font-family: var(--display), system-ui, sans-serif;
  font-weight: 400;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  color: var(--text);
  line-height: 1.15;
}
.herd-app .brand-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Hero brand panel */
.herd-app .hero-brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem 1.75rem;
  align-items: center;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.35rem;
  background:
    linear-gradient(135deg, rgba(48, 203, 101, 0.08), transparent 50%),
    #ffffff;
  border: 1px solid rgba(253, 195, 0, 0.28);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.herd-app .hero-brand-mark {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(253, 195, 0, 0.6);
  box-shadow:
    0 0 0 6px rgba(253, 195, 0, 0.1),
    0 8px 28px rgba(0, 0, 0, 0.35),
    0 0 40px rgba(253, 195, 0, 0.2);
  overflow: hidden;
  flex-shrink: 0;
}
.herd-app .hero-brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 6px;
}
.herd-app .hero-brand-copy { min-width: 0; }
.herd-app .hero-brand-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold, #e8c36a);
}
.herd-app .hero-brand-title {
  margin: 0 0 0.4rem;
}
.herd-app .hero-brand-tag {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.herd-app .hero-brand-actions {
  align-self: start;
}
.herd-app .hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.85rem;
}
.herd-app .hero-links a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
.herd-app .hero-links a:hover {
  color: var(--gold-bright);
  border-bottom-color: rgba(253, 195, 0, 0.5);
}

.herd-app .nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex: 1 1 100%;
  order: 3;
  justify-content: flex-start;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.15rem 0 0.4rem;
}
.herd-app .nav-tabs::-webkit-scrollbar { display: none; }
.herd-app .nav-tab {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.herd-app .nav-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.herd-app .nav-tab.is-active {
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  box-shadow: 0 2px 12px var(--gold-glow);
}

.herd-app .topbar-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

/* Big obvious “back to main site” CTA in the topbar */
.herd-app .btn-home-site {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.95rem 0.55rem 0.75rem;
  border-radius: 999px;
  background: #30cb65;
  color: #ffffff !important;
  text-decoration: none !important;
  border: 2px solid #30cb65;
  box-shadow: 0 4px 16px rgba(48, 203, 101, 0.35);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s, border-color 0.15s;
  max-width: 16rem;
}
.herd-app .btn-home-site:hover, .herd-app .btn-home-site:focus-visible {
  background: #28b558;
  border-color: #fdd61f;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(48, 203, 101, 0.45);
  outline: none;
}
.herd-app .btn-home-site-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.herd-app .btn-home-site-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  min-width: 0;
  line-height: 1.15;
}
.herd-app .btn-home-site-text strong {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.herd-app .btn-home-site-text em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

/* Logo / brand is a clear home control */
.herd-app .brand {
  cursor: pointer;
}
.herd-app .brand:hover .brand-mark {
  box-shadow:
    0 0 0 3px rgba(253, 214, 31, 0.35),
    0 0 20px rgba(48, 203, 101, 0.35);
  transform: scale(1.03);
}
.herd-app .brand-mark {
  transition: transform 0.15s, box-shadow 0.15s;
}
.herd-app .brand-sub {
  color: var(--header-muted, rgba(255, 255, 255, 0.72));
  font-weight: 600;
}

/* Hero / primary home CTAs */
.herd-app .hero-logo-link {
  display: block;
  border-radius: 50%;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.herd-app .hero-logo-link:hover, .herd-app .hero-logo-link:focus-visible {
  transform: scale(1.04);
  box-shadow:
    0 0 0 4px rgba(48, 203, 101, 0.25),
    0 8px 28px rgba(0, 45, 51, 0.15);
  outline: none;
}
.herd-app .btn-home-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  background: #30cb65 !important;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid #30cb65 !important;
  text-decoration: none !important;
  box-shadow: 0 4px 16px rgba(48, 203, 101, 0.3);
  white-space: nowrap;
}
.herd-app .btn-home-primary:hover, .herd-app .btn-home-primary:focus-visible {
  background: #28b558 !important;
  border-color: #fdd61f !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}
.herd-app .hero-brand-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: stretch;
}
.herd-app .hero-home-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #30cb65;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.82rem;
  border-bottom: none !important;
}
.herd-app .hero-home-cta:hover {
  background: #28b558;
  color: #ffffff !important;
}
.herd-app .footer-brand {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.15s;
}
.herd-app .footer-brand:hover {
  opacity: 0.85;
  color: inherit;
}
.herd-app .footer-home-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: #30cb65;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.85rem;
}
.herd-app .footer-home-cta:hover {
  background: #28b558;
  color: #ffffff !important;
}
.herd-app .site-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.herd-app .site-link:hover {
  color: var(--gold);
  border-color: var(--border-strong);
  background: var(--gold-dim);
}
.herd-app .sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elev);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.herd-app .sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 0 3px rgba(107, 116, 136, 0.2);
}
.herd-app .sync-pill.is-static .sync-dot {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(253, 195, 0, 0.75);
}
.herd-app .sync-pill.is-live .sync-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  animation: pulse-dot 2.4s ease infinite;
}
.herd-app .sync-pill.is-error .sync-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Main */
.herd-app .main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Error */
.herd-app .error-banner {
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(240, 113, 120, 0.35);
  background: linear-gradient(135deg, rgba(240, 113, 120, 0.12), rgba(240, 113, 120, 0.04));
  padding: 1rem 1.25rem;
}
.herd-app .error-banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  font-size: 0.9rem;
}
.herd-app .error-banner code {
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: var(--gold);
}

/* Sections */
.herd-app .section {
  margin-bottom: 3.5rem;
  scroll-margin-top: calc(var(--topbar-h) + 1.5rem);
}
.herd-app .section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  flex-wrap: wrap;
}
.herd-app .eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.35rem;
}
.herd-app .section-title {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.herd-app .section-title.display {
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.herd-app .section-desc {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.herd-app .section-actions { display: flex; gap: 0.5rem; }
.herd-app .herd-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elev);
}

/* Buttons */
.herd-app .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.herd-app .btn:active { transform: scale(0.98); }
.herd-app .btn-secondary {
  background: var(--bg-elev);
  border-color: var(--border-subtle);
  color: var(--text);
}
.herd-app .btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.herd-app .btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}
.herd-app .btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }
.herd-app .btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.herd-app .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.herd-app .icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

/* Cards — solid black panels (SFR site vibe, not frosted teal) */
.herd-app .glass-card {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  padding: 1.35rem 1.5rem;
}
.herd-app .card-head { margin-bottom: 1.1rem; }
.herd-app .card-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.herd-app .card-sub {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* KPI grid */
.herd-app .kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.herd-app .kpi-card {
  position: relative;
  overflow: hidden;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #ffffff;
  backdrop-filter: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.herd-app .kpi-card.is-clickable {
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.herd-app .kpi-card.is-clickable:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.herd-app .kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--kpi-accent, var(--gold)), transparent);
  opacity: 0.7;
}
.herd-app .kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.herd-app .kpi-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.herd-app .kpi-value {
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}
.herd-app .kpi-hint {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.herd-app .kpi-card.accent-gold { --kpi-accent: var(--gold); }
.herd-app .kpi-card.accent-green { --kpi-accent: var(--green); }
.herd-app .kpi-card.accent-blue { --kpi-accent: var(--blue); }
.herd-app .kpi-card.accent-muted { --kpi-accent: var(--text-dim); }

/* Overview grid */
.herd-app .overview-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
}
.herd-app .species-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.25rem;
  align-items: center;
}
.herd-app .chart-wrap {
  position: relative;
  width: 160px;
  height: 160px;
}
.herd-app .species-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.herd-app button.species-row, .herd-app .species-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.875rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent !important;
  color: #fff !important;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.herd-app button.species-row:hover, .herd-app .species-row:hover, .herd-app button.species-row:focus-visible, .herd-app .species-row:focus-visible {
  background: rgba(253, 195, 0, 0.1) !important;
  border-color: rgba(253, 195, 0, 0.25);
  outline: none;
}
.herd-app .species-chip, .herd-app button.species-chip, .herd-app span.species-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  background: #1a1a1a;
  color: #fff;
  line-height: 1.2;
}
.herd-app button.species-chip, .herd-app .species-chip.is-clickable {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, filter 0.15s;
}
.herd-app button.species-chip:hover, .herd-app .species-chip.is-clickable:hover {
  transform: translateY(-1px);
  filter: brightness(1.12);
  box-shadow: 0 0 0 1px rgba(253, 195, 0, 0.35);
}
.herd-app .species-bar-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.herd-app .species-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.6s var(--ease);
}
.herd-app .species-count {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #fff;
  min-width: 2ch;
  text-align: right;
}

.herd-app .quick-glance { display: flex; flex-direction: column; gap: 0.65rem; }
.herd-app .glance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  transition: background 0.2s, border-color 0.2s;
}
.herd-app .glance-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}
.herd-app .glance-left { min-width: 0; }
.herd-app .glance-name {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.herd-app .glance-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.1rem;
}
.herd-app .glance-val {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--gold);
  white-space: nowrap;
}

/* Filters */
.herd-app .filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  margin-bottom: 1rem;
  align-items: flex-end;
  padding: 1rem 1.25rem;
}
.herd-app .field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 140px; }
.herd-app .field-grow { flex: 1; min-width: 200px; }
.herd-app .field-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.herd-app .input {
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #ffffff !important;
  color: #fff !important;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.herd-app .input:hover { border-color: rgba(253, 195, 0, 0.35); }
.herd-app .input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.herd-app .input::placeholder { color: #8a8a8a; }
.herd-app select.input option {
  background: #ffffff;
  color: #fff;
}
.herd-app .select {
  appearance: none;
  -webkit-appearance: none;
  background-color: #ffffff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23fdc300' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.herd-app .view-toggle {
  display: inline-flex;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--bg-deep);
}
.herd-app .view-btn {
  padding: 0.5rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.herd-app .view-btn:hover { color: var(--text); }
.herd-app .view-btn.is-active {
  background: var(--gold-dim);
  color: var(--gold);
}

/* Table */
.herd-app .table-card { padding: 0; overflow: hidden; }
.herd-app .table-scroll { overflow-x: auto; }
.herd-app .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.herd-app .data-table th {
  text-align: left;
  padding: 0.85rem 1.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  white-space: nowrap;
}
.herd-app .data-table th.num { text-align: right; }
.herd-app .data-table td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  vertical-align: middle;
}
.herd-app .data-table tbody tr {
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.herd-app .data-table tbody tr:hover { background: rgba(232, 195, 106, 0.05); }
.herd-app .data-table tbody tr:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}
.herd-app .data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.herd-app .animal-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.herd-app .cell-muted { color: var(--text-muted); font-size: 0.85rem; }

/* Status badges */
.herd-app .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.herd-app .badge-active {
  color: var(--green);
  background: var(--green-dim);
  border-color: rgba(94, 207, 142, 0.25);
}
.herd-app .badge-inactive {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}
.herd-app .badge-event {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Species chips — solid dark plates + bright label color (readable on black UI) */
.herd-app .sp-BOV, .herd-app button.species-chip.sp-BOV {
  color: #fdc300 !important;
  background: #1a1608 !important;
  border-color: rgba(253, 195, 0, 0.45) !important;
}
.herd-app .sp-CAP, .herd-app button.species-chip.sp-CAP {
  color: #4dff8a !important;
  background: #0b1a10 !important;
  border-color: rgba(49, 203, 101, 0.45) !important;
}
.herd-app .sp-OVI, .herd-app button.species-chip.sp-OVI {
  color: #8ec8ff !important;
  background: #0a1420 !important;
  border-color: rgba(110, 181, 255, 0.45) !important;
}
.herd-app .sp-AVI, .herd-app button.species-chip.sp-AVI {
  color: #ffc48a !important;
  background: #1a120a !important;
  border-color: rgba(255, 188, 125, 0.5) !important;
}
.herd-app .sp-EQU, .herd-app button.species-chip.sp-EQU {
  color: #d0b6ff !important;
  background: #14101c !important;
  border-color: rgba(183, 148, 246, 0.45) !important;
}
.herd-app .sp-SUI, .herd-app button.species-chip.sp-SUI {
  color: #ff9aa0 !important;
  background: #1a0e10 !important;
  border-color: rgba(240, 113, 120, 0.45) !important;
}
.herd-app .sp-CAM, .herd-app button.species-chip.sp-CAM {
  color: #5dffc8 !important;
  background: #0a1a16 !important;
  border-color: rgba(48, 203, 157, 0.45) !important;
}
.herd-app .sp-TUR, .herd-app button.species-chip.sp-TUR {
  color: #e0c4a0 !important;
  background: #181410 !important;
  border-color: rgba(196, 164, 132, 0.5) !important;
}

/* Herd cards view */
.herd-app .herd-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  padding: 1.15rem;
}
.herd-app .herd-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s var(--ease), background 0.2s;
}
.herd-app .herd-card:hover {
  border-color: var(--border-strong);
  background: rgba(232, 195, 106, 0.04);
  transform: translateY(-2px);
}
.herd-app .herd-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.herd-app .herd-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.herd-app .herd-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.herd-app .empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Paddock board */
.herd-app .paddock-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.herd-app .paddock-col {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  background: var(--glass);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 140px;
  transition: border-color 0.25s;
}
.herd-app .paddock-col:hover { border-color: var(--border); }
.herd-app .paddock-col-head {
  padding: 1rem 1.15rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}
.herd-app .paddock-name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.herd-app button.paddock-name-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-align: left;
  cursor: pointer;
}
.herd-app button.paddock-name-btn:hover, .herd-app button.paddock-name-btn:focus-visible {
  color: var(--gold);
  outline: none;
}
.herd-app .linkish {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--gold);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.herd-app .linkish:hover {
  color: var(--gold-bright);
  border-bottom-color: rgba(253, 195, 0, 0.45);
}
.herd-app .paddock-stats {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  gap: 0.75rem;
}
.herd-app .paddock-animals {
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}
.herd-app .paddock-animal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  width: 100%;
}
.herd-app .paddock-animal:hover {
  background: rgba(232, 195, 106, 0.06);
  border-color: var(--border);
}
.herd-app .paddock-animal:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.herd-app .pa-name { font-weight: 500; font-size: 0.85rem; }
.herd-app .pa-meta { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.1rem; }
.herd-app .paddock-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-style: italic;
}

/* Timeline */
.herd-app .timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.herd-app .timeline::before {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: linear-gradient(180deg, var(--border-strong), transparent);
}
.herd-app .timeline-item {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.85rem;
  padding: 0.65rem 0.25rem;
  position: relative;
}
.herd-app .timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0.4rem auto 0;
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-dim);
  z-index: 1;
}
.herd-app .timeline-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.herd-app .timeline-item:hover .timeline-body {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--border-subtle);
}
.herd-app .timeline-main { min-width: 0; flex: 1; }
.herd-app .timeline-summary {
  font-size: 0.9rem;
  color: var(--text);
}
.herd-app .timeline-animal {
  color: var(--gold);
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}
.herd-app .timeline-animal:hover { text-decoration: underline; }
.herd-app .timeline-animal:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}
.herd-app .timeline-date {
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Event type colors */
.herd-app .ev-AHTR { --ev: var(--red); background: var(--red-dim); border-color: rgba(240, 113, 120, 0.3); color: var(--red); }
.herd-app .ev-AMWE { --ev: var(--blue); background: var(--blue-dim); border-color: rgba(110, 181, 255, 0.3); color: var(--blue); }
.herd-app .ev-ALMO { --ev: var(--teal); background: var(--teal-dim); border-color: rgba(79, 209, 197, 0.3); color: var(--teal); }
.herd-app .ev-ALBI { --ev: var(--green); background: var(--green-dim); border-color: rgba(94, 207, 142, 0.3); color: var(--green); }
.herd-app .ev-ALSA { --ev: var(--orange); background: var(--orange-dim); border-color: rgba(240, 163, 94, 0.3); color: var(--orange); }
.herd-app .ev-AANO { --ev: var(--purple); background: var(--purple-dim); border-color: rgba(183, 148, 246, 0.3); color: var(--purple); }
.herd-app .ev-ALPU { --ev: var(--gold); background: var(--gold-dim); border-color: rgba(232, 195, 106, 0.3); color: var(--gold); }
.herd-app .ev-ALDE { --ev: var(--text-muted); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: var(--text-muted); }
.herd-app .ev-default { --ev: var(--text-muted); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: var(--text-muted); }
.herd-app .timeline-dot.ev-AHTR { background: var(--red); box-shadow: 0 0 0 4px var(--red-dim); }
.herd-app .timeline-dot.ev-AMWE { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-dim); }
.herd-app .timeline-dot.ev-ALMO { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-dim); }
.herd-app .timeline-dot.ev-ALBI { background: var(--green); box-shadow: 0 0 0 4px var(--green-dim); }
.herd-app .timeline-dot.ev-ALSA { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-dim); }
.herd-app .timeline-dot.ev-AANO { background: var(--purple); box-shadow: 0 0 0 4px var(--purple-dim); }
.herd-app .timeline-dot.ev-ALPU { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-dim); }

/* Treatments / products */
.herd-app .split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.herd-app .list-dense {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 420px;
  overflow-y: auto;
}
.herd-app .list-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.15s, background 0.15s;
}
.herd-app .list-row:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.herd-app .list-row-main { min-width: 0; flex: 1; }
.herd-app .list-row-title {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.herd-app .list-row-sub {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.35;
}
.herd-app .list-row-side {
  text-align: right;
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.herd-app .product-type {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.15rem;
}
.herd-app .product-qty {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--text);
}
.herd-app .product-qty.neg { color: var(--red); }

/* Footer */
.herd-app .footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.herd-app .footer-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
  padding: 3px;
  border: 1px solid rgba(253, 195, 0, 0.4);
  box-shadow: 0 0 12px rgba(253, 195, 0, 0.18);
}
.herd-app .footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem 1.5rem 2.25rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}
.herd-app .footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 1.5rem;
}
.herd-app .footer-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.herd-app .footer-brand-text strong {
  color: var(--text);
  font-weight: 600;
}
.herd-app .footer-brand-text span {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.herd-app .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.herd-app .footer-links a {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.herd-app .footer-links a:hover { color: var(--gold); }
.herd-app .footer-meta {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.72rem;
  opacity: 0.85;
  word-break: break-all;
}

/* Drawer */
.herd-app .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.herd-app .drawer-backdrop.is-open { opacity: 1; }

.herd-app .drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 210;
  width: var(--drawer-w);
  background: linear-gradient(180deg, #141922 0%, #0e1218 100%);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.35s var(--ease);
  outline: none;
}
.herd-app .drawer.is-open { transform: translateX(0); }

.herd-app .drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.35rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.herd-app .drawer-title {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.herd-app .drawer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.herd-app .drawer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.55rem 1rem 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
}
.herd-app .drawer-tab {
  flex: 0 0 auto;
  padding: 0.4rem 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.herd-app .drawer-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.herd-app .drawer-tab.is-active {
  color: var(--gold);
  background: var(--gold-dim);
}
.herd-app .drawer-tab:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.herd-app .drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem 1.35rem 2rem;
}
.herd-app .drawer-panel { display: none; }
.herd-app .drawer-panel.is-active { display: block; }

.herd-app .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.herd-app .detail-item {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}
.herd-app .detail-item.full { grid-column: 1 / -1; }
.herd-app .detail-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.herd-app .detail-value {
  font-size: 0.92rem;
  font-weight: 500;
  word-break: break-word;
}
.herd-app .detail-value.muted { color: var(--text-muted); font-weight: 400; }

.herd-app .drawer-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 1.25rem 0 0.65rem;
}

.herd-app .weight-chart-wrap {
  position: relative;
  height: 160px;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}
.herd-app .value-chart-wrap {
  height: 180px;
  background: #f7faf8;
  border-color: var(--border);
}

.herd-app .drawer-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.herd-app .drawer-list-item {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
  font-size: 0.875rem;
}
.herd-app .drawer-list-item .dli-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.herd-app .drawer-list-item .dli-date {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.herd-app .drawer-list-item .dli-body { color: var(--text-muted); font-size: 0.82rem; }
.herd-app .drawer-empty {
  padding: 1.5rem 0.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Skeletons */
.herd-app .skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
.herd-app .skel-lg { height: 2.2rem; width: 55%; margin-bottom: 0.5rem; }
.herd-app .skel-sm { height: 0.85rem; width: 35%; }
.herd-app .skel-row { height: 1.1rem; width: 100%; margin: 0.35rem 0; }
.herd-app .skeleton-card { min-height: 100px; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Scrollbars */
.herd-app .timeline::-webkit-scrollbar, .herd-app .list-dense::-webkit-scrollbar, .herd-app .drawer-body::-webkit-scrollbar, .herd-app .table-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.herd-app .timeline::-webkit-scrollbar-thumb, .herd-app .list-dense::-webkit-scrollbar-thumb, .herd-app .drawer-body::-webkit-scrollbar-thumb, .herd-app .table-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 1024px) {
  .herd-app .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .herd-app .overview-grid { grid-template-columns: 1fr; }
  .herd-app .split-grid { grid-template-columns: 1fr; }
  .herd-app .brand-title { max-width: 160px; font-size: 1.05rem; }
  .herd-app .hero-brand { grid-template-columns: auto 1fr; }
  .herd-app .hero-brand-actions { grid-column: 1 / -1; justify-self: start; }
  .herd-app .hero-brand-mark { width: 96px; height: 96px; }
}

@media (max-width: 768px) {
  .herd-app .topbar-inner { padding: 0 1rem; gap: 0.75rem; }
  .herd-app .nav-tabs { justify-content: flex-start; }
  .herd-app .main { padding: 1.25rem 1rem 3rem; }
  .herd-app .section-title.display { font-size: 2rem; }
  .herd-app .species-layout { grid-template-columns: 1fr; justify-items: center; }
  .herd-app .kpi-value { font-size: 2rem; }
  .herd-app .detail-grid { grid-template-columns: 1fr; }
  .herd-app .brand-kicker { display: none; }
  .herd-app .brand-mark-lg { width: 48px; height: 48px; }
  .herd-app .btn-home-site-text em { display: none; }
  .herd-app .btn-home-site { padding: 0.5rem 0.75rem; max-width: none; }
  .herd-app .sync-pill { display: none; }
  .herd-app .hero-brand {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
  .herd-app .hero-brand-mark { width: 110px; height: 110px; }
  .herd-app .hero-brand-actions { justify-self: center; }
}

@media (max-width: 520px) {
  .herd-app .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .herd-app .filters-bar { flex-direction: column; align-items: stretch; }
  .herd-app .field, .herd-app .field-grow { min-width: 0; width: 100%; }
}

/* ---------- Analytics / ADG ---------- */
.herd-app .analytics-strip { margin-top: 1.25rem; }
.herd-app .row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.herd-app .adg-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin: 0.75rem 0 1rem;
}
.herd-app .adg-kpi {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.herd-app .adg-kpi.tone-gold { border-color: rgba(232,195,106,0.28); box-shadow: inset 0 0 0 1px rgba(232,195,106,0.06); }
.herd-app .adg-kpi.tone-green { border-color: rgba(94,207,142,0.25); }
.herd-app .adg-kpi-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.herd-app .adg-kpi-value {
  font-family: var(--display), system-ui, sans-serif;
  font-size: 1.65rem;
  color: var(--text);
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.herd-app .adg-kpi-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }

.herd-app .insight-rail, .herd-app .insights-list {
  display: grid;
  gap: 0.75rem;
}
.herd-app .insight-rail { grid-template-columns: repeat(3, 1fr); }
.herd-app .insights-list { grid-template-columns: 1fr; }
.herd-app .insight-card {
  background: rgba(12,14,18,0.45);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  border-left: 3px solid rgba(232,195,106,0.55);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.herd-app .insight-card[data-action] { cursor: pointer; }
.herd-app .insight-card[data-action]:hover { transform: translateY(-1px); border-color: rgba(232,195,106,0.35); }
.herd-app .insight-card.sev-high { border-left-color: #f07178; }
.herd-app .insight-card.sev-medium { border-left-color: #f0a35e; }
.herd-app .insight-card.sev-positive { border-left-color: #5ecf8e; }
.herd-app .insight-card.sev-info { border-left-color: #6eb5ff; }
.herd-app .insight-sev {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}
.herd-app .insight-title { font-size: 0.98rem; font-weight: 600; margin: 0 0 0.35rem; color: var(--text); }
.herd-app .insight-body { font-size: 0.84rem; color: var(--text-muted); margin: 0; line-height: 1.45; }
.herd-app .insight-cat {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.herd-app .analytics-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.herd-app .analytics-grid-2 { grid-template-columns: 1fr 1fr; }
.herd-app .chart-wrap-md { height: 220px; position: relative; margin-bottom: 0.75rem; }

.herd-app .rank-list { display: flex; flex-direction: column; gap: 0.4rem; }
.herd-app .rank-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.herd-app .rank-row:hover { background: rgba(253,195,0,0.1); border-color: rgba(253,195,0,0.28); }
.herd-app .rank-num {
  font-family: var(--display), system-ui, sans-serif;
  font-size: 1.15rem;
  color: var(--gold);
  opacity: 0.9;
}
.herd-app .rank-main { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.herd-app .rank-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.herd-app .rank-adg { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.herd-app .rank-adg strong { font-variant-numeric: tabular-nums; }

.herd-app .rate-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.herd-app .rate-excellent { background: rgba(94,207,142,0.18); color: #7de0b0; }
.herd-app .rate-on { background: rgba(94,207,142,0.12); color: #5ecf8e; }
.herd-app .rate-fair { background: rgba(253,195,0,0.16); color: var(--gold); }
.herd-app .rate-below { background: rgba(240,163,94,0.16); color: #f0a35e; }
.herd-app .rate-losing { background: rgba(240,113,120,0.18); color: #f07178; }
.herd-app .rate-muted { background: rgba(255,255,255,0.06); color: var(--text-dim); }

.herd-app .mini-table-wrap { overflow-x: auto; }
.herd-app .mini-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.herd-app .mini-table th, .herd-app .mini-table td { padding: 0.4rem 0.35rem; border-bottom: 1px solid rgba(255,255,255,0.05); text-align: left; }
.herd-app .mini-table th { color: var(--text-dim); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.herd-app .mini-table .num, .herd-app .data-table .num { font-variant-numeric: tabular-nums; text-align: right; }
.herd-app .method-note { margin-top: 0.85rem; font-size: 0.75rem; color: var(--text-dim); line-height: 1.4; }

.herd-app .adg-panel {
  margin-bottom: 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(253,195,0,0.1), rgba(255,255,255,0.02));
  border: 1px solid rgba(253,195,0,0.2);
}
.herd-app .adg-panel.muted-panel {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.06);
}
.herd-app .adg-panel .detail-value.gold { color: var(--gold); }
.herd-app .adg-panel .unit { font-size: 0.75rem; color: var(--text-dim); font-weight: 500; }
.herd-app .adg-bench-note { font-size: 0.75rem; color: var(--text-muted); margin: 0.55rem 0 0; line-height: 1.4; }

/* --------------------------------------------------------------------------
   Public page extras: paddock chips, group drawer, filter chips
   -------------------------------------------------------------------------- */
.herd-app .paddock-chips-card { margin-top: 1rem; }
.herd-app .paddock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.herd-app button.paddock-chip, .herd-app .paddock-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid rgba(253, 195, 0, 0.22);
  background: #161616 !important;
  color: #fff !important;
  font: inherit;
  cursor: pointer;
  text-align: left;
  min-width: 8rem;
  transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.herd-app button.paddock-chip:hover, .herd-app .paddock-chip:hover, .herd-app button.paddock-chip:focus-visible, .herd-app .paddock-chip:focus-visible {
  border-color: rgba(253, 195, 0, 0.55);
  background: #1e1a0c !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  outline: none;
}
.herd-app .paddock-chip-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff !important;
  letter-spacing: 0.01em;
}
.herd-app .paddock-chip-meta {
  font-size: 0.72rem;
  color: #b0b0b0 !important;
  font-weight: 500;
}

.herd-app .filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  align-items: center;
}
.herd-app .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.55rem 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 600;
}
.herd-app .filter-chip button {
  border: 0;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}
.herd-app .filter-chip button:hover { background: rgba(0, 0, 0, 0.45); }

.herd-app .group-drawer { z-index: 230; }
.herd-app #group-backdrop { z-index: 220; }
.herd-app .group-animal-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.herd-app .group-animal-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.herd-app .group-animal-btn:hover {
  background: rgba(253, 195, 0, 0.1);
  border-color: rgba(253, 195, 0, 0.25);
}
.herd-app .group-animal-btn strong {
  display: block;
  font-size: 0.92rem;
}
.herd-app .group-animal-btn .meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.herd-app .group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

@media (max-width: 1024px) {
  .herd-app .adg-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .herd-app .insight-rail { grid-template-columns: 1fr; }
  .herd-app .analytics-grid, .herd-app .analytics-grid-2 { grid-template-columns: 1fr; }
  .herd-app .hero-brand { grid-template-columns: auto 1fr; }
  .herd-app .hero-brand-actions { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .herd-app .brand-sub { display: none; }
  .herd-app .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .herd-app .overview-grid { grid-template-columns: 1fr; }
  .herd-app .species-layout { grid-template-columns: 1fr; justify-items: center; }
  .herd-app .field { min-width: 120px; }
  .herd-app .btn-home-site-text strong { font-size: 0.82rem; }
  .herd-app .hero-brand-actions { width: 100%; }
  .herd-app .btn-home-primary { width: 100%; }
}

/* Animal photos + public WEB bios */
.herd-app .animal-thumb {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  background: #f0f2f3;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.herd-app .animal-thumb-sm {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.herd-app .animal-thumb-placeholder {
  background: linear-gradient(135deg, #e8eef1, #f5f5f7);
}
.herd-app .animal-name-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.herd-app .herd-card-media {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}
.herd-app .herd-card-bio {
  margin: 0.45rem 0 0.55rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.herd-app .animal-about {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: #f8fafb;
}
.herd-app button.animal-about-photo, .herd-app .animal-about-photo {
  position: relative;
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 14px;
}
.herd-app .animal-about-photo img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: #fff;
  display: block;
  transition: box-shadow 0.15s, transform 0.15s;
}
.herd-app button.animal-about-photo:hover img, .herd-app button.animal-about-photo:focus-visible img {
  box-shadow: 0 0 0 3px rgba(48, 203, 101, 0.35);
  transform: scale(1.02);
  outline: none;
}
.herd-app .animal-about-photo-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
}
.herd-app .animal-about-photo-empty {
  width: 140px;
  height: 140px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e8eef1, #f5f5f7);
  border: 1px dashed var(--border);
  cursor: default;
}

/* Full-size photo lightbox */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(0, 22, 27, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.photo-lightbox.is-open {
  display: flex;
}
.photo-lightbox-img {
  max-width: min(920px, 92vw);
  max-height: min(80vh, 920px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  cursor: default;
}
.photo-lightbox-caption {
  margin: 0;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}
.photo-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.photo-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}
.herd-app .animal-about-bio {
  margin: 0.35rem 0 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
}
.herd-app .animal-about-bio.muted {
  color: var(--text-muted);
  font-size: 0.88rem;
}
@media (max-width: 520px) {
  .herd-app .animal-about {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .herd-app *, .herd-app *::before, .herd-app *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .herd-app { scroll-behavior: auto; }
}


/* ==========================================================================
   Equity — East Texas Livestock (Crockett) market value
   All new selectors prefixed equity- so other pages stay put.
   ========================================================================== */

.herd-app .equity-warning {
  margin-bottom: 1rem;
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid rgba(184, 134, 11, 0.4);
  background: #fff8d6;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}
.herd-app .equity-warning strong {
  display: block;
  margin-bottom: 0.2rem;
  font-weight: 700;
}
.herd-app .equity-warning-error {
  margin-top: 0.35rem;
  color: #8a1f1f;
  font-size: 0.84rem;
}

.herd-app .equity-cite {
  margin-bottom: 1.15rem;
  border-left: 4px solid var(--gold);
  background: #ffffff;
}
.herd-app .equity-cite-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem 1.5rem;
}
.herd-app .equity-source-card.is-missing { opacity: 0.55; }
@media (max-width: 768px) {
  .herd-app .equity-cite-grid { grid-template-columns: 1fr; }
}
.herd-app .equity-cite-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.herd-app .equity-cite-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.herd-app .equity-cite-loc, .herd-app .equity-cite-meta {
  margin-top: 0.15rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.herd-app .equity-cite-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  margin-top: 0.15rem;
}
.herd-app .equity-cite a, .herd-app a.equity-link {
  color: #0f7a3a;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.herd-app .equity-cite a:hover, .herd-app a.equity-link:hover {
  color: #0b5c2c;
}
.herd-app .equity-method {
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.5;
}
.herd-app .equity-method p + p {
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.herd-app .equity-kpi-row {
  margin-bottom: 1.15rem;
}
.herd-app .equity-kpi-row .kpi-value {
  font-variant-numeric: tabular-nums;
  font-size: 1.85rem;
}

.herd-app .equity-table-card {
  margin-bottom: 1.15rem;
}
.herd-app .equity-table-head {
  padding: 1.15rem 1.35rem 0.35rem;
  margin-bottom: 0;
}
.herd-app .equity-money {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.herd-app .equity-unpriced td {
  color: var(--text-muted);
}

.herd-app .equity-cards {
  display: none;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  padding: 0.85rem 1rem 1.1rem;
}
.herd-app .equity-card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  color: inherit;
  width: 100%;
  font: inherit;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.herd-app .equity-card:hover {
  border-color: rgba(48, 203, 101, 0.35);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.herd-app .equity-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.herd-app .equity-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}
.herd-app .equity-card-name {
  font-weight: 700;
  font-size: 1rem;
  color: #0f7a3a;
}
.herd-app .equity-card-sex {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}
.herd-app .equity-card-note {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0.55rem;
}
.herd-app .equity-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}
.herd-app .equity-card-metric .lbl {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.12rem;
}
.herd-app .equity-card-metric .val {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.herd-app .equity-market-card {
  margin-bottom: 0.5rem;
}
.herd-app .equity-market-scroll {
  overflow-x: auto;
}
.herd-app .equity-sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 32rem;
}
.herd-app .equity-sheet th, .herd-app .equity-sheet td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  color: var(--text);
}
.herd-app .equity-sheet th {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: #f8fafb;
  white-space: nowrap;
}
.herd-app .equity-sheet .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.herd-app .equity-sheet .equity-high, .herd-app .equity-high {
  font-weight: 700;
  color: #6a5200;
  background: #fff8d6;
}
.herd-app .equity-sheet th.equity-high {
  color: #6a5200;
  background: #fff3b0;
}
.herd-app .equity-sheet-caption {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.herd-app .equity-sheet-caption:first-child {
  margin-top: 0;
}

@media (max-width: 768px) {
  .herd-app .equity-cite-grid {
    grid-template-columns: 1fr;
    gap: 0.95rem;
  }
  .herd-app .equity-kpi-row.kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .herd-app .equity-table-scroll {
    display: none;
  }
  .herd-app .equity-cards {
    display: grid;
  }
  .herd-app .equity-kpi-row .kpi-value {
    font-size: 1.45rem;
  }
}

@media (max-width: 520px) {
  .herd-app .equity-kpi-row.kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }
  .herd-app .equity-card-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --------------------------------------------------------------------------
   Ranch dark restyle + layout that does not fight site.css
   -------------------------------------------------------------------------- */

.herd-app {
  background: transparent;
  color: var(--text);
  min-height: 40vh;
}

.herd-app .app-bg { display: none; }

.herd-app .herd-section-nav {
  position: sticky;
  top: var(--header-h, 4.25rem);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 1rem 0.55rem;
  background: rgba(20, 17, 14, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  scrollbar-width: thin;
}
.herd-app .herd-section-nav::-webkit-scrollbar { height: 6px; }
.herd-app .herd-section-nav::-webkit-scrollbar-thumb {
  background: rgba(201, 162, 74, 0.35);
  border-radius: 3px;
}

.herd-app .nav-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.2rem;
  flex: 1 1 auto;
  order: 0;
  justify-content: flex-start;
  min-width: max-content;
  overflow: visible;
  padding: 0.15rem 0.25rem;
}
.herd-app .nav-tab {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--display);
  white-space: nowrap;
}
.herd-app .nav-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.herd-app .nav-tab.is-active {
  color: #1a140c;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  box-shadow: 0 2px 12px var(--gold-glow);
}

.herd-app .topbar-meta { margin-left: auto; flex-shrink: 0; }

.herd-app .main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.herd-app .section {
  padding: 0;
  margin-bottom: 3.2rem;
  scroll-margin-top: calc(var(--header-h, 4.25rem) + 3.4rem);
}

.herd-app .section-title,
.herd-app .drawer-title,
.herd-app .card-title,
.herd-app .kpi-value,
.herd-app .adg-kpi-value,
.herd-app .glance-val,
.herd-app .product-qty {
  font-family: var(--display);
  letter-spacing: 0.03em;
  text-transform: none;
}

.herd-app h1.section-title,
.herd-app .section-title.display {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.herd-app .glass-card,
.herd-app .kpi-card,
.herd-app .paddock-col,
.herd-app .herd-card,
.herd-app .table-card,
.herd-app .adg-kpi,
.herd-app .insight-card,
.herd-app .equity-card,
.herd-app .equity-cite,
.herd-app .filters-bar,
.herd-app .filters {
  background: var(--bg-elev) !important;
  border: 1px solid var(--border-subtle) !important;
  box-shadow: var(--shadow) !important;
  color: var(--text) !important;
  backdrop-filter: none !important;
}

.herd-app .hero-brand {
  background:
    linear-gradient(135deg, rgba(47, 74, 60, 0.28), transparent 55%),
    var(--bg-elev) !important;
  border: 1px solid var(--border) !important;
  grid-template-columns: auto 1fr auto;
}

.herd-app .hero-brand-kicker { color: var(--gold) !important; }
.herd-app .hero-brand-title,
.herd-app .section-title,
.herd-app .card-title { color: var(--text) !important; }
.herd-app .section-desc,
.herd-app .card-sub,
.herd-app .hero-brand-tag,
.herd-app .kpi-hint,
.herd-app .cell-muted { color: var(--text-muted) !important; }

.herd-app .kpi-card { background: var(--bg-elev-2) !important; }
.herd-app .kpi-value { color: var(--gold-bright) !important; }

.herd-app .input,
.herd-app select.input,
.herd-app .select {
  background: var(--bg-deep) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
.herd-app .input:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px var(--gold-dim) !important;
}
.herd-app select.input option {
  background: var(--bg-elev);
  color: var(--text);
}
.herd-app .input::placeholder { color: var(--text-dim); }

.herd-app button.species-row,
.herd-app .species-row {
  background: transparent !important;
  color: var(--text) !important;
}
.herd-app button.species-row:hover,
.herd-app .species-row:hover {
  background: rgba(201, 162, 74, 0.1) !important;
  border-color: rgba(201, 162, 74, 0.25) !important;
}
.herd-app .species-count { color: var(--text) !important; }
.herd-app .species-bar-track { background: rgba(244, 234, 216, 0.08) !important; }

.herd-app .species-chip,
.herd-app button.species-chip,
.herd-app span.species-chip {
  background: #1a1608 !important;
  color: var(--gold-bright) !important;
  border: 1px solid rgba(201, 162, 74, 0.4) !important;
}

.herd-app button.paddock-chip,
.herd-app .paddock-chip {
  background: var(--bg-elev-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
.herd-app .paddock-chip-name { color: var(--text) !important; }
.herd-app .paddock-chip-meta { color: var(--text-muted) !important; }

.herd-app .data-table th {
  color: var(--text-dim) !important;
  background: rgba(0, 0, 0, 0.28) !important;
  border-bottom-color: var(--border) !important;
}
.herd-app .data-table td {
  color: var(--text) !important;
  border-bottom-color: var(--border-subtle) !important;
}
.herd-app .data-table tbody tr:hover { background: rgba(201, 162, 74, 0.08) !important; }

.herd-app .btn-secondary {
  background: var(--bg-elev) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.herd-app .btn-ghost {
  background: transparent !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.herd-app .view-btn {
  background: transparent !important;
  color: var(--text-muted) !important;
}
.herd-app .view-btn.is-active {
  background: var(--gold-dim) !important;
  color: var(--gold-bright) !important;
}

.herd-app .glance-item,
.herd-app .list-row,
.herd-app .rank-row,
.herd-app .group-animal-btn,
.herd-app .paddock-animal,
.herd-app .herd-card,
.herd-app .drawer-list-item,
.herd-app .detail-item {
  background: rgba(0, 0, 0, 0.22) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text) !important;
}
.herd-app .timeline-animal,
.herd-app .linkish,
.herd-app .equity-card-name,
.herd-app .equity-cite a,
.herd-app a.equity-link {
  color: var(--gold-bright) !important;
}

.herd-app .drawer {
  background: linear-gradient(180deg, #1c1814 0%, #14110e 100%) !important;
  color: var(--text) !important;
  border-left: 1px solid var(--border) !important;
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.55) !important;
}
.herd-app .drawer-backdrop {
  background: rgba(10, 8, 6, 0.72) !important;
}
.herd-app .drawer-tab.is-active {
  color: var(--gold) !important;
  background: var(--gold-dim) !important;
}

.herd-app .animal-about {
  background: rgba(0, 0, 0, 0.22) !important;
  border-color: var(--border-subtle) !important;
}
.herd-app .animal-thumb,
.herd-app .animal-about-photo img {
  background: #0f0d0b !important;
  border-color: var(--border) !important;
}
.herd-app .animal-thumb-placeholder,
.herd-app .animal-about-photo-empty {
  background: linear-gradient(135deg, #252019, #1c1814) !important;
}

.herd-app .equity-warning {
  background: rgba(201, 162, 74, 0.12) !important;
  border-color: rgba(201, 162, 74, 0.4) !important;
  color: var(--text) !important;
}
.herd-app .equity-cite { border-left: 4px solid var(--gold) !important; }
.herd-app .equity-sheet th {
  background: rgba(0, 0, 0, 0.28) !important;
  color: var(--text-dim) !important;
}
.herd-app .equity-sheet td { color: var(--text) !important; }
.herd-app .equity-sheet .equity-high,
.herd-app .equity-high {
  color: var(--gold-bright) !important;
  background: rgba(201, 162, 74, 0.16) !important;
}

.herd-app .error-banner {
  background: rgba(196, 92, 62, 0.14) !important;
  border-color: rgba(196, 92, 62, 0.4) !important;
  color: var(--text) !important;
}

.herd-app .skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 75%) !important;
}

.herd-app .weight-chart-wrap,
.herd-app .value-chart-wrap {
  background: rgba(0, 0, 0, 0.28) !important;
  border-color: var(--border-subtle) !important;
}

.herd-app .sync-pill {
  background: var(--bg-elev);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}
.herd-app .herd-snapshot {
  margin: 0 auto 1.5rem;
  max-width: var(--max);
  padding: 0 1rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.photo-lightbox {
  background: rgba(20, 17, 14, 0.92) !important;
}

@media (max-width: 860px) {
  .herd-app .herd-section-nav {
    padding: 0.5rem 0.75rem 0.65rem;
  }
}
@media (max-width: 700px) {
  .herd-app .nav-tabs {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
  }
  .herd-app .field-view { display: none !important; }
  .herd-app #herd-table-wrap > .table-scroll { display: none !important; }
  .herd-app #herd-cards { display: grid !important; }
  .herd-app .equity-table-scroll { display: none !important; }
  .herd-app .equity-cards { display: grid !important; }
  .herd-app .hero-brand {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
  .herd-app .kpi-grid,
  .herd-app .adg-kpi-row { grid-template-columns: 1fr 1fr; }
  .herd-app .overview-grid,
  .herd-app .analytics-grid,
  .herd-app .analytics-grid-2,
  .herd-app .split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .herd-app .filters-bar { flex-direction: column; align-items: stretch; }
  .herd-app .field,
  .herd-app .field-grow { min-width: 0; width: 100%; }
  .herd-app .sync-pill span:last-child {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
