/* Jameel Noori Nastaleeq for Urdu/Arabic script only (unicode-range): Latin text keeps the system font,
   and the font file is only downloaded when Urdu text is shown or printed. */
@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: url('../fonts/jameel-noori-nastaleeq.woff') format('woff');
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
:root {
  --bs-font-sans-serif: 'Jameel Noori Nastaleeq', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', 'Liberation Sans', Arial, sans-serif;
  --bs-body-font-family: var(--bs-font-sans-serif);
  --topbar-h: 52px;
  --bottomnav-h: 62px;
  --sidebar-w: 236px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --farm-green: #2e7d32;
  --bs-primary: #2e7d32;
  --bs-primary-rgb: 46,125,50;
}

/* RTL layout overrides for Urdu */
[dir="rtl"] #sidebar { left: auto; right: 0; border-right: 0; border-left: 1px solid var(--bs-border-color); }
[dir="rtl"] .app-main { margin-left: 0; }
@media (min-width: 992px) { [dir="rtl"] .app-main { margin-right: var(--sidebar-w); } }
[dir="rtl"] .nav-menu .nav-link { border-left: 0; border-right: 3px solid transparent; }
[dir="rtl"] .nav-menu .nav-link.active { border-right-color: var(--bs-primary); border-left: 0; }
[dir="rtl"] .list-row .end { text-align: left; }
[dir="rtl"] .offcanvas-start { left: auto; right: 0; transform: translateX(100%); }
[dir="rtl"] .offcanvas-start.show { transform: none; }
[dir="rtl"] .dropdown-menu-end { --bs-position: start; }
[dir="rtl"] .page-header { flex-direction: row-reverse; }
[dir="rtl"] .page-header a { flex-direction: row-reverse; }
[dir="rtl"] .table-report td.num, [dir="rtl"] .table-report th.num { text-align: left; }
html, body { height: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; background: var(--bs-tertiary-bg); }
[data-bs-theme="dark"] body { background: #14171a; }
button, .btn, a { touch-action: manipulation; }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: var(--bs-tertiary-bg); --bs-btn-color: var(--bs-body-color); --bs-btn-border-color: var(--bs-border-color); --bs-btn-hover-bg: var(--bs-secondary-bg); --bs-btn-hover-color: var(--bs-body-color); --bs-btn-hover-border-color: var(--bs-border-color); --bs-btn-active-bg: var(--bs-secondary-bg); --bs-btn-active-color: var(--bs-body-color); --bs-btn-disabled-bg: var(--bs-tertiary-bg); --bs-btn-disabled-color: var(--bs-secondary-color); }
[data-bs-theme="dark"] .table-light { --bs-table-bg: var(--bs-tertiary-bg); --bs-table-color: var(--bs-body-color); --bs-table-border-color: var(--bs-border-color); }
[data-bs-theme="dark"] .text-bg-light { background-color: var(--bs-tertiary-bg) !important; color: var(--bs-body-color) !important; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Splash */
#splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bs-body-bg); z-index: 3000; }
#splash img { border-radius: 20px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 16px; max-width: 420px; margin: 0 auto; }
.login-card { border: 0; border-radius: 16px; }
#toggle-pw { z-index: 5; }

/* Login page goat farm visuals */
#view-login { background: linear-gradient(175deg,#ffe0b2 0%,#b3e5fc 20%,#e8f5e9 58%,#c8e6c9 100%); position: relative; overflow: hidden; }
[data-bs-theme="dark"] #view-login { background: linear-gradient(175deg,#1a0600 0%,#030d1c 22%,#0a180a 60%,#0a1a0a 100%); }
.login-landscape { position: fixed; bottom: 0; left: 0; right: 0; pointer-events: none; z-index: 0; line-height: 0; }
[data-bs-theme="dark"] .login-landscape { opacity: 0.2; }
.login-wrap { position: relative; z-index: 1; padding-bottom: 135px; }
.login-mascot { display: flex; justify-content: center; margin-bottom: 6px; filter: drop-shadow(0 5px 14px rgba(0,70,20,0.2)); }
.login-goat-svg { width: min(190px,48vw); height: auto; }

/* Layout */
#view-app { min-height: 100vh; }
#sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); background: var(--bs-body-bg); border-right: 1px solid var(--bs-border-color); z-index: 1020; }
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 600; border-bottom: 1px solid var(--bs-border-color); }
.sidebar-brand img { border-radius: 6px; }
.nav-menu { flex-wrap: nowrap; }
#sidebar .nav-menu { overflow-x: hidden; }
.app-main { min-height: 100vh; }
@media (min-width: 992px) { .app-main { margin-left: var(--sidebar-w); } }
.app-topbar { position: sticky; top: 0; z-index: 1010; height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color); }
#content { padding: 12px 12px calc(var(--bottomnav-h) + var(--safe-b) + 16px); max-width: 1400px; margin: 0 auto; outline: none; }
@media (min-width: 992px) { #content { padding: 20px 24px 32px; } }

.nav-menu .nav-link { color: var(--bs-body-color); padding: 10px 16px; display: flex; align-items: center; gap: 12px; border-left: 3px solid transparent; }
.nav-menu .nav-link i { font-size: 1.15rem; width: 22px; text-align: center; }
.nav-menu .nav-link:hover { background: var(--bs-secondary-bg); }
.nav-menu .nav-link.active { color: var(--bs-primary); background: var(--bs-primary-bg-subtle); border-left-color: var(--bs-primary); font-weight: 600; }
.nav-menu .nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); padding: 14px 16px 4px; }

#bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; height: calc(var(--bottomnav-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); }
#bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--bs-secondary-color); font-size: .7rem; gap: 2px; }
#bottom-nav a i { font-size: 1.3rem; }
#bottom-nav a.active { color: var(--bs-primary); }
#bottom-nav a.nav-sell i { background: var(--bs-primary); color: #fff; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 4px 12px rgba(13,110,253,.4); font-size: 1.4rem; }
#bottom-nav a.nav-milk i { background: #1565c0; color: #fff; width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 4px 12px rgba(21,101,192,.4); font-size: 1.4rem; }
body.focus-mode #bottom-nav { display: none; }
body.focus-mode #content { padding-bottom: 0; }

/* Animal status badges */
.badge-active   { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.badge-sold     { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }
.badge-dead     { background: #fafafa; color: #616161; border: 1px solid #bdbdbd; }
.badge-culled   { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.badge-pregnant { background: #fce4ec; color: #880e4f; border: 1px solid #f48fb1; }
.badge-female   { background: #f3e5f5; color: #4a148c; border: 1px solid #ce93d8; }
.badge-male     { background: #e8eaf6; color: #1a237e; border: 1px solid #9fa8da; }

/* Dashboard stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 576px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-tile { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 12px; padding: 14px; text-align: center; }
.stat-tile .st-icon { font-size: 1.6rem; margin-bottom: 4px; }
.stat-tile .st-val  { font-size: 1.4rem; font-weight: 700; line-height: 1.1; }
.stat-tile .st-lbl  { font-size: .72rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .04em; }

/* Dashboard chart grid */
.dash-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
@media (max-width: 575px) { .dash-charts { grid-template-columns: 1fr; } }
.dash-chart-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 12px; padding: 14px; }
.dash-chart-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--bs-secondary-color); margin-bottom: 10px; }
/* Donut + legend layout */
.dash-donut-wrap { display: flex; align-items: center; gap: 12px; }
.dash-legend { flex: 1; min-width: 0; }
.dash-legend-item { display: flex; align-items: center; gap: 6px; font-size: .8rem; padding: 2px 0; }
.dash-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
/* Horizontal bar rows */
.dbar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dbar-label { font-size: .78rem; width: 76px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbar-track { flex: 1; height: 10px; background: var(--bs-secondary-bg); border-radius: 5px; overflow: hidden; }
.dbar-fill { height: 100%; border-radius: 5px; min-width: 3px; }
.dbar-val { font-size: .75rem; font-weight: 700; width: 32px; text-align: right; flex-shrink: 0; }
/* Vertical bar chart (trend) */
.vchart { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.vchart-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.vchart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.vchart-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 3px; }
.vchart-val { font-size: .64rem; font-weight: 700; color: var(--bs-body-color); line-height: 1.3; min-height: 13px; }
.vchart-lbl { font-size: .62rem; color: var(--bs-secondary-color); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
/* Empty state inside chart card */
.chart-empty { display: flex; align-items: center; justify-content: center; height: 70px; }

/* Animal card grid */
.animal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.animal-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 12px; padding: 12px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.animal-card:hover { background: var(--bs-secondary-bg); }
.animal-card .ac-tag { font-size: .7rem; color: var(--bs-secondary-color); }
.animal-card .ac-name { font-weight: 700; font-size: .95rem; }
.animal-card .ac-breed { font-size: .78rem; color: var(--bs-secondary-color); }
.animal-card .ac-badges { display: flex; flex-wrap: wrap; gap: 4px; }

/* Health event type colors */
.evt-vaccination { color: #1565c0; }
.evt-treatment   { color: #b71c1c; }
.evt-checkup     { color: #2e7d32; }
.evt-deworming   { color: #6a1b9a; }
.evt-vitamin     { color: #e65100; }

/* Pregnancy tracker */
.preg-bar { height: 6px; border-radius: 3px; background: var(--bs-secondary-bg); overflow: hidden; margin-top: 4px; }
.preg-bar-fill { height: 100%; background: #e91e63; border-radius: 3px; transition: width .3s; }

/* Milk chart bar */
.milk-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.milk-bar-label { width: 80px; font-size: .78rem; color: var(--bs-secondary-color); text-align: right; flex-shrink: 0; }
[dir="rtl"] .milk-bar-label { text-align: left; }
.milk-bar-track { flex: 1; height: 14px; background: var(--bs-secondary-bg); border-radius: 7px; overflow: hidden; }
.milk-bar-fill { height: 100%; background: #1565c0; border-radius: 7px; }
.milk-bar-val { width: 50px; font-size: .78rem; font-weight: 600; flex-shrink: 0; }

/* Tab nav for animal detail */
.detail-tabs .nav-link { font-size: .85rem; padding: .5rem .75rem; }

/* Timeline for health/breeding events */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--bs-border-color); }
[dir="rtl"] .timeline-item:not(:last-child)::before { left: auto; right: 17px; }
.timeline-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-body .tl-title { font-weight: 600; }
.timeline-body .tl-meta { font-size: .78rem; color: var(--bs-secondary-color); }

/* Connection badge */
#conn-badge { font-weight: 500; font-size: .72rem; padding: .4em .7em; }
.conn-online { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.conn-offline { background: var(--bs-secondary-bg); color: var(--bs-secondary-color); }

#loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 2500; display: flex; align-items: center; justify-content: center; }
#loading-overlay.d-none { display: none !important; }
.toast-container { z-index: 2600; }

/* Cards & lists */
.card { border-color: var(--bs-border-color-translucent); }
.stat-card { border: 0; border-radius: 12px; }
.stat-card .stat-label { font-size: .75rem; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .03em; }
.stat-card .stat-value { font-size: 1.25rem; font-weight: 700; }
.quick-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 6px; border-radius: 12px; background: var(--bs-body-bg); text-decoration: none; color: var(--bs-body-color); font-size: .8rem; text-align: center; border: 1px solid var(--bs-border-color-translucent); }
.quick-action i { font-size: 1.5rem; color: var(--bs-primary); }
.quick-action:active { transform: scale(.97); }
.list-card { background: var(--bs-body-bg); border-radius: 12px; overflow: hidden; border: 1px solid var(--bs-border-color-translucent); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--bs-border-color-translucent); color: inherit; text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover, button.list-row:hover { background: var(--bs-secondary-bg); }
button.list-row { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { font-size: .8rem; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .end { text-align: right; white-space: nowrap; }
.thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--bs-secondary-bg); display: flex; align-items: center; justify-content: center; color: var(--bs-secondary-color); flex-shrink: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters > * { flex: 1 1 140px; }
.filters .flex-grow-2 { flex: 2 1 220px; }
.table-report { font-size: .85rem; }
.table-report th { white-space: nowrap; }
.table-report td.num, .table-report th.num { text-align: right; white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 20px; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); white-space: nowrap; font-size: .85rem; cursor: pointer; }
.chip.active { background: var(--bs-primary); color: #fff; border-color: var(--bs-primary); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

/* POS */
.pos { display: grid; grid-template-columns: 1fr; gap: 12px; margin: -12px -12px 0; }
.pos-left { display: none; }
.pos-right { display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h)); background: var(--bs-body-bg); }
@media (min-width: 992px) {
  .pos { grid-template-columns: 1fr 440px; margin: -20px -24px -32px; gap: 0; }
  .pos-left { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); padding: 12px; overflow: hidden; }
  .pos-right { height: calc(100vh - var(--topbar-h)); min-height: 0; border-left: 1px solid var(--bs-border-color); }
}
.pos.show-browse .pos-left { display: flex; flex-direction: column; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 1040; background: var(--bs-tertiary-bg); padding: 12px; overflow: hidden; }
@media (min-width: 992px) { .pos.show-browse .pos-left { position: static; background: none; } }
.pos-search { position: sticky; top: var(--topbar-h); z-index: 20; padding: 10px 12px; background: var(--bs-body-bg); border-bottom: 1px solid var(--bs-border-color-translucent); }
@media (min-width: 992px) { .pos-search { top: 0; } }
.pos-search .input-group-lg .form-control { font-size: 1.05rem; }
.search-results { position: absolute; left: 12px; right: 12px; top: 100%; z-index: 30; max-height: 55vh; overflow-y: auto; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.pos-meta { padding: 8px 12px; display: flex; gap: 8px; border-bottom: 1px solid var(--bs-border-color-translucent); }
.pos-meta .btn { flex: 0 0 auto; }
.pos-meta .btn-party { flex: 1 1 auto; min-width: 0; text-align: left; }
.pos-lines { flex: 1; overflow-y: auto; }
.cart-line { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--bs-border-color-translucent); align-items: center; }
.cart-line .info { flex: 1; min-width: 0; cursor: pointer; }
.cart-line .name { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-line .meta { font-size: .78rem; color: var(--bs-secondary-color); }
.qty-ctl { display: flex; align-items: center; border: 1px solid var(--bs-border-color); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.qty-ctl button { border: 0; background: var(--bs-secondary-bg); width: 36px; height: 38px; font-size: 1.1rem; color: var(--bs-body-color); }
.qty-ctl input { width: 52px; border: 0; text-align: center; height: 38px; background: var(--bs-body-bg); color: var(--bs-body-color); font-weight: 600; }
.cart-line .amt { width: 84px; text-align: right; font-weight: 600; flex-shrink: 0; }
.pos-footer { position: sticky; bottom: 0; background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color); padding: 10px 12px calc(10px + var(--safe-b)); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.pos-footer .total { font-size: 1.5rem; font-weight: 800; }
.btn-pay { font-size: 1.1rem; font-weight: 700; padding: 12px 18px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; overflow-y: auto; padding-bottom: 12px; align-content: start; }
.product-tile { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 10px; padding: 8px; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 96px; }
.product-tile:active { transform: scale(.97); }
.product-tile img, .product-tile .ph { width: 100%; height: 64px; object-fit: cover; border-radius: 6px; background: var(--bs-secondary-bg); display: flex; align-items: center; justify-content: center; color: var(--bs-secondary-color); }
.product-tile .n { font-size: .82rem; font-weight: 600; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-tile .p { font-size: .8rem; color: var(--bs-primary); font-weight: 700; }
.product-tile .s { font-size: .7rem; color: var(--bs-secondary-color); }
.pay-quick .btn { flex: 1 1 22%; }
.checkout-total { font-size: 2rem; font-weight: 800; }

/* Scanner */
.scanner-box { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; }
.scanner-box video { width: 100%; height: 100%; object-fit: cover; }
.scanner-box .scan-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ff3b30; box-shadow: 0 0 8px #ff3b30; }
#html5qr-region video { border-radius: 12px; }

.empty-state i { opacity: .5; }
.form-label { font-size: .85rem; margin-bottom: .25rem; font-weight: 500; }
.modal-fullscreen-sm-down .modal-body { padding-bottom: calc(1rem + var(--safe-b)); }

/* Print */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff !important; }
  #print-area { display: block !important; color: #000; }
}
.receipt { font-family: 'Jameel Noori Nastaleeq', 'Courier New', monospace; color: #000; background: #fff; font-size: 12px; line-height: 1.3; margin: 0 auto; }
.receipt.w58 { width: 48mm; }
.receipt.w80 { width: 72mm; }
.receipt .c { text-align: center; }
.receipt .r { text-align: right; }
.receipt .b { font-weight: bold; }
.receipt .big { font-size: 15px; }
.receipt .ur { font-size: 1.6em; line-height: 1.7; unicode-bidi: plaintext; }
.receipt .c .ur, .receipt .r .ur { display: inline-block; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 4px 0; opacity: 1; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { vertical-align: top; padding: 0; }
.print-report { color: #000; font-size: 11px; }
.print-report h2 { font-size: 16px; margin: 0 0 4px; }
.print-report table { width: 100%; border-collapse: collapse; }
.print-report th, .print-report td { border: 1px solid #999; padding: 3px 5px; }
.print-report td.num, .print-report th.num { text-align: right; }
.receipt-preview { background: #fff; padding: 12px 6px; border-radius: 8px; border: 1px solid var(--bs-border-color); overflow-x: auto; }

/* Settings page rows */
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--bs-border-color-translucent); }
.settings-row:last-child { border-bottom: 0; }
.settings-label { font-size: .875rem; flex: 0 0 140px; color: var(--bs-body-color); }
.settings-value { flex: 1; min-width: 0; }

/* Section header in list cards */
.list-section-header { padding: 6px 12px; font-size: .73rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); background: var(--bs-secondary-bg); border-bottom: 1px solid var(--bs-border-color-translucent); }

/* Pregnancy progress bar */
.pregnancy-bar .progress-bar { transition: width .4s ease; }

/* Detail page tabs */
.detail-tabs { border-bottom: 1px solid var(--bs-border-color-translucent); }
.detail-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; color: var(--bs-secondary-color); font-size: .85rem; }
.detail-tabs .nav-link.active { border-bottom-color: var(--bs-primary); color: var(--bs-primary); font-weight: 600; background: none; }

/* Report tabs */
.rpt-tab { font-size: .78rem; padding: 5px 10px; }

/* Text pink for female icon */
.text-pink { color: #e91e63; }

/* ═══════════════════════════════════════════════════════════════════════════
   GOAT FARM ANIMATIONS & ENHANCED VISUALS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Keyframes ─────────────────────────────────────────────────────────────── */
@keyframes goat-bob {
  0%, 100% { transform: translateY(0)    rotate(0deg); }
  28%      { transform: translateY(-10px) rotate(-1.8deg); }
  72%      { transform: translateY(-5px)  rotate(0.9deg); }
}
@keyframes mascot-enter {
  from { opacity: 0; transform: translateY(28px) scale(.78); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
@keyframes card-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cloud-drift {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(14px); }
}
@keyframes cloud-drift-r {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-13px); }
}
@keyframes sun-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0  8px rgba(255,224,80,.22), 0 0 0 22px rgba(255,224,80,.08); }
  50%      { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(255,224,80,.28), 0 0 0 34px rgba(255,224,80,.11); }
}
@keyframes bird-fly {
  from { transform: translateX(0) translateY(0);                opacity: 0; }
  5%   { opacity: 1; }
  93%  { opacity: 0.75; }
  to   { transform: translateX(calc(100vw + 120px)) translateY(-22px); opacity: 0; }
}
@keyframes tile-pop {
  from { opacity: 0; transform: translateY(16px) scale(.88); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}
@keyframes content-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes login-bg-breathe {
  0%, 100% { background-position:   0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes sway {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(1.2deg); }
}
@keyframes sway-r {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-1.1deg); }
}
@keyframes blink {
  0%, 49%, 100% { opacity: 1; }
  50%, 99% { opacity: 0; }
}
@keyframes bounce-big {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(46,125,50,.6)); }
  50%      { filter: drop-shadow(0 0 10px rgba(46,125,50,.9)); }
}
@keyframes float-gentle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%      { transform: translateY(-4px) rotate(.8deg); }
  66%      { transform: translateY(-2px) rotate(-.6deg); }
}
@keyframes wobble-fence {
  0%, 100% { transform: scaleX(1) skewY(0deg); }
  50%      { transform: scaleX(0.98) skewY(.3deg); }
}
@keyframes water-wave {
  0%, 100% { d: path('M0,10 Q25,5 50,10 T100,10 L100,15 Q75,20 50,15 T0,15Z'); }
  50%      { d: path('M0,12 Q25,8 50,12 T100,12 L100,13 Q75,18 50,13 T0,13Z'); }
}
@keyframes counter-pop {
  0%   { opacity: 0; transform: translateY(8px) scale(.7); }
  50%  { opacity: 1; transform: translateY(-2px) scale(1.15); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes milk-pour {
  0%   { clip-path: inset(100% 0 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}
@keyframes barn-door-creak {
  0%, 100% { transform: perspective(600px) rotateY(0deg); }
  50%      { transform: perspective(600px) rotateY(2deg); }
}
@keyframes shimmer-in {
  from { opacity: 0; transform: scaleX(.2); }
  to   { opacity: 1; transform: scaleX(1); }
}

/* ── Animated login background ──────────────────────────────────────────────── */
#view-login {
  background-size: 220% 220%;
  animation: login-bg-breathe 14s ease infinite;
}
[data-bs-theme="dark"] #view-login { animation-duration: 22s; }

/* ── Sky layer ──────────────────────────────────────────────────────────────── */
.login-sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

/* Sun */
.login-sun-orb {
  position: absolute;
  top: 7%; right: 9%;
  width: 58px; height: 58px;
  background: radial-gradient(circle at 36% 36%, #fff9c4, #ffca28 52%, #ffa000);
  border-radius: 50%;
  animation: sun-pulse 5.5s ease-in-out infinite;
}
[data-bs-theme="dark"] .login-sun-orb { display: none; }

/* Moon (dark mode) */
.login-moon-orb {
  display: none;
  position: absolute;
  top: 8%; right: 10%;
  width: 44px; height: 44px;
  background: #dde8c0;
  border-radius: 50%;
  box-shadow: -9px -3px 0 0 #0a1a0a, inset 0 0 14px rgba(255,255,200,.12);
}
[data-bs-theme="dark"] .login-moon-orb { display: block; }

/* CSS Clouds */
.lc { position: absolute; background: rgba(255,255,255,.82); border-radius: 50px; pointer-events: none; }
.lc::before, .lc::after { content: ''; position: absolute; background: rgba(255,255,255,.82); border-radius: 50%; }
[data-bs-theme="dark"] .lc,
[data-bs-theme="dark"] .lc::before,
[data-bs-theme="dark"] .lc::after { background: rgba(55,75,100,.26); }

.lc1 { width: 98px; height: 28px; top: 5%; left: 3%;  animation: cloud-drift 9.5s ease-in-out infinite; }
.lc1::before { width: 52px; height: 52px; top: -25px; left: 10px; }
.lc1::after  { width: 38px; height: 38px; top: -18px; left: 48px; }

.lc2 { width: 74px; height: 22px; top: 3%; left: 36%; animation: cloud-drift-r 12s ease-in-out infinite; animation-delay: -4s; }
.lc2::before { width: 40px; height: 40px; top: -19px; left: 8px; }
.lc2::after  { width: 28px; height: 28px; top: -13px; left: 37px; }

.lc3 { width: 86px; height: 25px; top: 9%; right: 5%; animation: cloud-drift 13.5s ease-in-out infinite; animation-delay: -7s; }
.lc3::before { width: 46px; height: 46px; top: -22px; left: 10px; }
.lc3::after  { width: 32px; height: 32px; top: -15px; left: 42px; }

/* Birds */
.login-bird { position: absolute; pointer-events: none; width: 28px; height: 14px; }
.login-bird::before, .login-bird::after {
  content: '';
  position: absolute;
  width: 13px; height: 8px;
  border-top: 2.5px solid rgba(30,100,40,.65);
  border-radius: 50% 50% 0 0;
}
.login-bird::before { left: 0;    top: 0; transform: rotate(-9deg); }
.login-bird::after  { left: 14px; top: 0; transform: rotate(9deg);  }

.lb1 { top: 16%; left: -65px; animation: bird-fly 26s linear infinite; }
.lb2 { top: 11%; left: -65px; animation: bird-fly 34s linear infinite; animation-delay: -12s; }

/* ── Mascot entrance + continuous bob ───────────────────────────────────────── */
.login-mascot { animation: mascot-enter .65s cubic-bezier(.34,1.56,.64,1) both .1s; }
.login-goat-svg { animation: goat-bob 3.8s ease-in-out infinite .75s; }

/* Animated landscape elements */
.farm-grass { animation: sway 3.2s ease-in-out infinite; transform-origin: bottom center; }
.farm-grass-2 { animation: sway-r 2.8s ease-in-out infinite; transform-origin: bottom center; animation-delay: .4s; }
.farm-grazer { animation: float-gentle 4.5s ease-in-out infinite; }
.farm-grazer-2 { animation: float-gentle 5.2s ease-in-out infinite; animation-delay: 1s; }
.farm-fence-post { animation: wobble-fence 2.8s ease-in-out infinite; transform-origin: bottom center; }
.farm-water { animation: water-wave 2s ease-in-out infinite; }
.farm-leaf { animation: sway 2.2s ease-in-out infinite; transform-origin: top center; }

/* Blinking eyes on mascot and distant animals */
.goat-eye-l, .goat-eye-r { animation: blink 3.5s ease-in-out infinite; }
.goat-eye-l { animation-delay: .2s; }
.goat-eye-r { animation-delay: .6s; }

/* Sway trees in the landscape SVG */
.farm-svg g[class*="lc"] { transform-origin: center bottom; animation: sway 2.5s ease-in-out infinite; }
.farm-svg polygon { transform-origin: center bottom; }

/* Bobbing goat silhouettes */
.farm-grazer { transform-origin: center; }
.farm-grazer-2 { transform-origin: center; }

/* ── Login card entrance ────────────────────────────────────────────────────── */
.login-card { animation: card-slide-up .52s ease-out both .28s; }

/* ── App content page transition ────────────────────────────────────────────── */
#content { animation: content-in .35s ease-out both; }

/* ── Stat tile entrance + hover lift ────────────────────────────────────────── */
.stat-tile {
  animation: tile-pop .48s cubic-bezier(.34,1.56,.64,1) both;
  transition: all .22s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-color: rgba(46,125,50,.15);
}
.stat-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(46,125,50,.08) 50%, transparent 100%);
  opacity: 0;
  transition: opacity .3s ease;
}
.stat-tile:hover {
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 16px 40px rgba(46,125,50,.2);
  border-color: rgba(46,125,50,.35);
}
.stat-tile:hover::before { opacity: 1; }
.stat-tile:active { transform: translateY(-4px) scale(1.05); }
.stat-tile:nth-child(1) { animation-delay:   0ms; }
.stat-tile:nth-child(2) { animation-delay:  90ms; }
.stat-tile:nth-child(3) { animation-delay: 180ms; }
.stat-tile:nth-child(4) { animation-delay: 270ms; }

/* Bouncing counter numbers in stat tiles */
.st-val { animation: counter-pop .6s cubic-bezier(.34,1.56,.64,1) both; }
.stat-tile:nth-child(1) .st-val { animation-delay: 400ms; }
.stat-tile:nth-child(2) .st-val { animation-delay: 490ms; }
.stat-tile:nth-child(3) .st-val { animation-delay: 580ms; }
.stat-tile:nth-child(4) .st-val { animation-delay: 670ms; }

/* ── Dashboard chart card hover ─────────────────────────────────────────────── */
.dash-chart-card {
  transition: all .28s ease;
  position: relative;
  overflow: hidden;
  border-color: rgba(46,125,50,.12);
}
.dash-chart-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(46,125,50,.05) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.dash-chart-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 36px rgba(46,125,50,.15);
  border-color: rgba(46,125,50,.25);
}
.dash-chart-card:hover::before { opacity: 1; }

/* Animated chart title */
.dash-chart-title { animation: content-in .4s ease-out both; font-weight: 800; letter-spacing: .08em; }

/* ── Horizontal bar animated fill ───────────────────────────────────────────── */
.dbar-fill { animation: shimmer-in .8s cubic-bezier(.25,.46,.45,.94) both; transform-origin: left; }

/* ── Nav link smooth slide indent ───────────────────────────────────────────── */
.nav-menu .nav-link {
  transition: all .18s ease;
  position: relative;
}
.nav-menu .nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(46,125,50,.8) 0%, rgba(46,125,50,0) 100%);
  transition: width .22s ease;
}
.nav-menu .nav-link:hover:not(.active) {
  padding-left: 24px;
  background: rgba(46,125,50,.06);
}
.nav-menu .nav-link:hover:not(.active)::after { width: 100%; }

/* ── Bottom nav press feedback ──────────────────────────────────────────────── */
#bottom-nav a { transition: color .15s, transform .12s; }
#bottom-nav a:active { transform: scale(.88); }
#bottom-nav a.active { transform: scale(1.06); }

/* ── Animal card hover ──────────────────────────────────────────────────────── */
.animal-card { transition: transform .18s ease, box-shadow .18s ease; }
.animal-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.09); }

/* ── List row slide-in ──────────────────────────────────────────────────────── */
.list-card .list-row { transition: background .12s; }

/* ── Magic-link auto-fill hint & button pulse ──────────────────────────────── */
.autofill-hint {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: .88rem;
  color: #1b5e20;
  text-align: center;
  direction: rtl;
  line-height: 1.7;
}
[data-bs-theme="dark"] .autofill-hint {
  background: #1b2e1c;
  border-color: #388e3c;
  color: #a5d6a7;
}
@keyframes autofill-pulse {
  0%, 100% { box-shadow: 0 0 0  0    rgba(46,125,50,.6); }
  50%       { box-shadow: 0 0 0 12px rgba(46,125,50,0);  }
}
.btn-autofill-pulse { animation: autofill-pulse 1.1s ease-out 3; }

/* ── Reduce motion: respect system preference ───────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .login-goat-svg, .login-mascot, .login-card, .lc, .lb1, .lb2,
  .login-sun-orb, #view-login, .stat-tile, #content, .dbar-fill { animation: none !important; }
  .stat-tile, .dash-chart-card, .nav-menu .nav-link, #bottom-nav a, .animal-card { transition: none !important; }
}
