/* 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-bg {
  min-height: 100vh;
  background: linear-gradient(150deg, #1b5e20 0%, #2e7d32 55%, #388e3c 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px 16px;
}
.login-wrap { width: 100%; max-width: 430px; margin: 0 auto; }
.login-card { border-radius: 22px !important; overflow: hidden; }
/* Farm scene header */
.login-scene-wrap { position: relative; background: #87ceeb; }
.login-scene { display: block; width: 100%; height: auto; }
.login-brand-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, transparent 100%);
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  color: white;
}
.login-logo-img { border-radius: 10px; flex-shrink: 0; box-shadow: 0 3px 10px rgba(0,0,0,0.25); }
.login-brand-name { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.login-brand-sub { font-size: .72rem; opacity: 0.82; margin-top: 1px; }
/* Form area */
.login-form-area { padding: 22px 24px 26px; background: var(--bs-body-bg); }
.login-footer-note { color: rgba(255,255,255,0.65); }
#toggle-pw { z-index: 5; }
/* Sidebar brand logo */
.brand-logo { border-radius: 6px; }

/* 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; }

/* 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; }

/* ================================================================
   DAIRY FARM MANAGER — Premium Visuals & Animations v2
   ================================================================ */

/* ---- Keyframes ---- */
@keyframes df-float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
@keyframes df-cloud-a {
  0%,100% { transform: translateX(0); }
  50%      { transform: translateX(18px); }
}
@keyframes df-cloud-b {
  0%,100% { transform: translateX(0); }
  50%      { transform: translateX(-13px); }
}
@keyframes df-sun-pulse {
  0%,100% { opacity:.65; transform:scale(1); }
  50%      { opacity:.95; transform:scale(1.18); }
}
@keyframes df-sun-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes df-cow-bob {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
@keyframes df-slide-up {
  from { opacity:0; transform:translateY(24px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes df-scale-in {
  from { opacity:0; transform:scale(.9); }
  to   { opacity:1; transform:scale(1); }
}
@keyframes df-fade-in {
  from { opacity:0; }
  to   { opacity:1; }
}
@keyframes df-pulse-ring {
  0%   { box-shadow:0 0 0 0 rgba(21,101,192,.6); }
  70%  { box-shadow:0 0 0 12px rgba(21,101,192,0); }
  100% { box-shadow:0 0 0 0 rgba(21,101,192,0); }
}
@keyframes df-gradient-shift {
  0%   { background-position:0% 50%; }
  50%  { background-position:100% 50%; }
  100% { background-position:0% 50%; }
}
@keyframes df-milk-wave {
  0%,100% { border-radius:14px 14px 14px 14px; }
  50%      { border-radius:22px 10px 18px 22px; }
}
@keyframes df-bounce-in {
  0%   { transform:scale(.3); opacity:0; }
  55%  { transform:scale(1.12); }
  75%  { transform:scale(.95); }
  100% { transform:scale(1); opacity:1; }
}
@keyframes df-count-in {
  from { opacity:0; transform:translateY(8px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes df-login-entry {
  from { opacity:0; transform:translateY(40px) scale(.95); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}
@keyframes df-nav-dot {
  from { transform:translateX(-50%) scaleX(0); }
  to   { transform:translateX(-50%) scaleX(1); }
}
@keyframes df-shimmer {
  0%   { background-position:-200% center; }
  100% { background-position:200% center; }
}
@keyframes autofill-pulse-anim {
  0%,100% { box-shadow:0 0 0 0 rgba(46,125,50,.55); }
  50%      { box-shadow:0 0 0 10px rgba(46,125,50,0); }
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */

/* Animated gradient background */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(-45deg,#0d3b1f,#1b5e20,#0a3d62,#155724,#1b5e20) !important;
  background-size: 400% 400% !important;
  animation: df-gradient-shift 14s ease infinite !important;
  display: flex; align-items: center; justify-content: center; padding: 20px 16px;
}

/* Card entry animation */
.login-card {
  border-radius: 22px !important;
  overflow: hidden;
  animation: df-login-entry .7s cubic-bezier(.34,1.56,.64,1) both;
  box-shadow: 0 28px 70px rgba(0,0,0,.38) !important;
}

/* Farm scene */
.login-scene-wrap { position: relative; background: #87ceeb; }
.login-scene { display: block; width: 100%; height: auto; }

/* SVG scene animations */
.df-cloud-a  { animation: df-cloud-a 9s ease-in-out infinite; }
.df-cloud-b  { animation: df-cloud-b 13s ease-in-out infinite; }
.df-sun-halo { animation: df-sun-pulse 5s ease-in-out infinite; transform-box:fill-box; transform-origin:center; }
.df-sun-rays { animation: df-sun-spin 24s linear infinite; transform-box:fill-box; transform-origin:52px 58px; }
.df-cow-group{ animation: df-cow-bob 4s ease-in-out infinite; transform-box:fill-box; transform-origin:center; }

/* Brand bar */
.login-brand-bar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.68) 0%, transparent 100%);
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px; color: white;
}
.login-logo-img {
  border-radius: 10px; flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(0,0,0,.32);
  animation: df-float 4s ease-in-out infinite;
}
.login-brand-name { font-size: 1.1rem; font-weight: 700; line-height: 1.2; text-shadow: 0 1px 5px rgba(0,0,0,.35); }
.login-brand-sub  { font-size: .72rem; opacity: .85; margin-top: 1px; }

/* Form area */
.login-form-area { padding: 22px 24px 26px; background: var(--bs-body-bg); }
.login-form-area .form-floating > .form-control { border-radius: 12px !important; transition: border-color .2s, box-shadow .2s; }
.login-form-area .form-control:focus {
  border-color: #2e7d32 !important;
  box-shadow: 0 0 0 .22rem rgba(46,125,50,.22) !important;
}

/* Login button */
#login-btn {
  background: linear-gradient(135deg,#2e7d32 0%,#388e3c 50%,#43a047 100%) !important;
  border: none !important; border-radius: 14px !important;
  font-size: 1.05rem !important; padding: 12px !important;
  position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s !important;
  box-shadow: 0 4px 18px rgba(46,125,50,.42) !important;
}
#login-btn:hover  { transform: translateY(-2px) !important; box-shadow: 0 8px 30px rgba(46,125,50,.52) !important; }
#login-btn:active { transform: translateY(0) !important; }
#login-btn::after {
  content:''; position:absolute; inset:0;
  background: linear-gradient(135deg,rgba(255,255,255,.18) 0%,transparent 60%);
  pointer-events:none;
}

/* Autofill */
.autofill-pulse { animation: autofill-pulse-anim 1.2s ease-in-out 4; }
.autofill-hint {
  font-size: 1rem; line-height: 1.8;
  border-radius: 12px !important; border: none !important;
  background: linear-gradient(135deg,#e8f5e9,#c8e6c9) !important;
  color: #1b5e20 !important;
}

.login-footer-note { color: rgba(255,255,255,.65); }
#toggle-pw { z-index: 5; }

/* ================================================================
   SPLASH
   ================================================================ */
#splash {
  background: linear-gradient(160deg,#0d3b1f 0%,#1b5e20 50%,#2e7d32 100%);
  color: white;
}
#splash img {
  animation: df-float 3s ease-in-out infinite;
  border-radius: 20px;
  box-shadow: 0 8px 36px rgba(0,0,0,.3);
}

/* ================================================================
   DASHBOARD — Greeting
   ================================================================ */
.dash-greeting {
  background: linear-gradient(-45deg,#1b5e20,#2e7d32,#0a3d62,#1565c0,#2e7d32);
  background-size: 300% 300%;
  animation: df-gradient-shift 12s ease infinite;
  color: white;
  border-radius: 20px;
  padding: 18px 22px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 6px 30px rgba(46,125,50,.32);
  margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.dash-greeting::before {
  content:''; position:absolute; top:-30px; right:-20px;
  width:150px; height:150px; border-radius:50%;
  background:rgba(255,255,255,.07); pointer-events:none;
}
.dash-greeting::after {
  content:''; position:absolute; bottom:-40px; left:-10px;
  width:110px; height:110px; border-radius:50%;
  background:rgba(255,255,255,.04); pointer-events:none;
}
.dash-greeting-name { font-size: 1.12rem; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.2); }
.dash-greeting-sub  { font-size: .78rem; opacity: .88; margin-top: 3px; }
.dash-greeting-icon {
  font-size: 2.6rem; opacity: 1;
  animation: df-float 3.5s ease-in-out infinite;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.25));
}

/* ================================================================
   DASHBOARD — Stat tiles
   ================================================================ */
.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 {
  border-radius: 18px !important;
  padding: 18px 12px !important;
  text-align: center;
  border: none !important;
  position: relative; overflow: hidden;
  transition: transform .22s, box-shadow .22s;
  animation: df-scale-in .42s ease both;
  cursor: default;
}
.stat-tile:hover { transform: translateY(-5px); }

/* Decorative circle */
.stat-tile::before {
  content:''; position:absolute; bottom:-22px; right:-22px;
  width:88px; height:88px; border-radius:50%;
  background:rgba(255,255,255,.17); pointer-events:none;
}

/* Colored tiles */
.stat-tile.st-green { background:linear-gradient(145deg,#e8f5e9 0%,#a5d6a7 100%); box-shadow:0 4px 18px rgba(46,125,50,.2); }
.stat-tile.st-blue  { background:linear-gradient(145deg,#e3f2fd 0%,#90caf9 100%); box-shadow:0 4px 18px rgba(21,101,192,.2); }
.stat-tile.st-amber { background:linear-gradient(145deg,#fff8e1 0%,#ffe082 100%); box-shadow:0 4px 18px rgba(249,168,37,.28); }
.stat-tile.st-pink  { background:linear-gradient(145deg,#fce4ec 0%,#f48fb1 100%); box-shadow:0 4px 18px rgba(233,30,99,.22); }

[data-bs-theme="dark"] .stat-tile.st-green { background:linear-gradient(145deg,rgba(27,94,32,.65) 0%,rgba(46,125,50,.42) 100%); }
[data-bs-theme="dark"] .stat-tile.st-blue  { background:linear-gradient(145deg,rgba(13,71,161,.65) 0%,rgba(21,101,192,.42) 100%); }
[data-bs-theme="dark"] .stat-tile.st-amber { background:linear-gradient(145deg,rgba(230,81,0,.65) 0%,rgba(245,124,0,.42) 100%); }
[data-bs-theme="dark"] .stat-tile.st-pink  { background:linear-gradient(145deg,rgba(136,14,79,.65) 0%,rgba(233,30,99,.42) 100%); }

/* Icon circle */
.stat-tile .st-icon {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
  font-size: 1.5rem;
  transition: transform .22s;
}
.stat-tile:hover .st-icon { transform: scale(1.14); }
.stat-tile.st-green .st-icon { background:rgba(46,125,50,.2); }
.stat-tile.st-green .st-icon i { color:#1b5e20; }
.stat-tile.st-blue  .st-icon { background:rgba(21,101,192,.2); }
.stat-tile.st-blue  .st-icon i { color:#0d47a1; }
.stat-tile.st-amber .st-icon { background:rgba(249,168,37,.3); }
.stat-tile.st-amber .st-icon i { color:#e65100; }
.stat-tile.st-pink  .st-icon { background:rgba(233,30,99,.18); }
.stat-tile.st-pink  .st-icon i { color:#880e4f; }

.stat-tile .st-val { font-size:1.9rem; font-weight:800; line-height:1; }
.stat-tile .st-lbl { font-size:.68rem; text-transform:uppercase; letter-spacing:.06em; margin-top:5px; opacity:.72; }

/* Staggered entrance */
.stat-tile:nth-child(1) { animation-delay:.04s; }
.stat-tile:nth-child(2) { animation-delay:.10s; }
.stat-tile:nth-child(3) { animation-delay:.16s; }
.stat-tile:nth-child(4) { animation-delay:.22s; }

/* Count-up animation */
.df-countup { animation: df-count-in .55s ease both; }

/* ================================================================
   DASHBOARD — Milk production card
   ================================================================ */
.milk-prod-card {
  background: linear-gradient(135deg,#e3f2fd 0%,#e8f5e9 100%);
  border-radius: 22px !important;
  padding: 18px;
  border: none !important;
  box-shadow: 0 4px 24px rgba(21,101,192,.13);
  animation: df-slide-up .5s .2s ease both;
  position: relative; overflow: hidden;
}
[data-bs-theme="dark"] .milk-prod-card {
  background: linear-gradient(135deg,rgba(13,27,42,.95) 0%,rgba(10,25,10,.95) 100%);
  box-shadow: 0 4px 24px rgba(0,0,0,.38);
}
.milk-prod-card::before {
  content:''; position:absolute; top:-45px; right:-30px;
  width:200px; height:200px; border-radius:50%;
  background:rgba(255,255,255,.15); pointer-events:none;
}

.milk-prod-header {
  display:flex; align-items:center; gap:8px; margin-bottom:14px;
  font-weight:700; font-size:.9rem; color:#1565c0;
}
[data-bs-theme="dark"] .milk-prod-header { color:#90caf9; }

.milk-sessions { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.milk-session-box {
  flex:1; background:rgba(255,255,255,.9); border-radius:14px;
  padding:12px 10px 10px; text-align:center;
  transition:transform .2s, box-shadow .2s;
  border: 1px solid rgba(255,255,255,.6);
}
[data-bs-theme="dark"] .milk-session-box { background:rgba(255,255,255,.08); border-color:rgba(255,255,255,.06); }
.milk-session-box:hover { transform:translateY(-3px); box-shadow:0 6px 18px rgba(0,0,0,.1); }
.milk-session-box .sess-icon  { font-size:1.1rem; margin-bottom:4px; }
.milk-session-box .sess-label { font-size:.67rem; text-transform:uppercase; letter-spacing:.05em; color:var(--bs-secondary-color); margin-bottom:3px; }
.milk-session-box .sess-val   { font-size:1.55rem; font-weight:800; color:#1565c0; line-height:1; }
[data-bs-theme="dark"] .milk-session-box .sess-val { color:#90caf9; }
.milk-session-box .sess-unit  { font-size:.72rem; color:var(--bs-secondary-color); }
.milk-session-plus { font-size:1.1rem; color:var(--bs-secondary-color); flex-shrink:0; }

.milk-total-box {
  background: linear-gradient(135deg,#2e7d32 0%,#1b5e20 100%);
  color:white; border-radius:14px; padding:14px 18px;
  display:flex; align-items:center; justify-content:space-between;
  box-shadow: 0 4px 20px rgba(46,125,50,.4);
  animation: df-milk-wave 5s ease-in-out infinite;
  position:relative; overflow:hidden;
}
.milk-total-box::after {
  content:''; position:absolute; bottom:-18px; right:-18px;
  width:90px; height:90px; border-radius:50%;
  background:rgba(255,255,255,.09); pointer-events:none;
}
.milk-total-box .total-label { font-size:.83rem; font-weight:600; opacity:.92; }
.milk-total-box .total-sub   { font-size:.72rem; opacity:.72; margin-top:2px; }
.milk-total-box .total-val   { font-size:2.3rem; font-weight:900; line-height:1; }
.milk-total-box .total-unit  { font-size:.9rem; opacity:.85; }

/* ================================================================
   DASHBOARD — Sales breakdown cards
   ================================================================ */
.sales-breakdown-card {
  background: var(--bs-body-bg);
  border-radius: 18px !important; border:none !important;
  box-shadow: 0 3px 18px rgba(0,0,0,.07);
  overflow:hidden; height:100%;
  transition: transform .22s, box-shadow .22s;
  animation: df-slide-up .5s .3s ease both;
}
.sales-breakdown-card:hover { transform:translateY(-4px); box-shadow:0 10px 32px rgba(0,0,0,.13) !important; }
[data-bs-theme="dark"] .sales-breakdown-card { box-shadow:0 3px 18px rgba(0,0,0,.3); border:1px solid rgba(255,255,255,.06) !important; }

.sb-header {
  padding:10px 16px; background:var(--bs-secondary-bg);
  font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em;
  color:var(--bs-secondary-color); border-bottom:1px solid var(--bs-border-color-translucent);
}
.sb-row {
  display:flex; align-items:center; gap:12px; padding:14px 16px;
  border-bottom:1px solid var(--bs-border-color-translucent);
  transition:background .15s;
}
.sb-row:last-child { border-bottom:0; }
.sb-row:hover { background:var(--bs-secondary-bg); }
.sb-type-icon {
  width:42px; height:42px; border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  font-size:1.1rem; flex-shrink:0;
  transition:transform .2s;
}
.sb-row:hover .sb-type-icon { transform:scale(1.12); }
.sb-type-icon.company { background:#e3f2fd; color:#1565c0; }
.sb-type-icon.local   { background:#e8f5e9; color:#2e7d32; }
[data-bs-theme="dark"] .sb-type-icon.company { background:rgba(21,101,192,.2); color:#90caf9; }
[data-bs-theme="dark"] .sb-type-icon.local   { background:rgba(46,125,50,.2);  color:#81c784; }
.sb-info { flex:1; min-width:0; }
.sb-info .sb-name { font-weight:600; font-size:.9rem; }
.sb-info .sb-qty  { font-size:.76rem; color:var(--bs-secondary-color); margin-top:1px; }
.sb-amount { font-weight:700; color:#2e7d32; font-size:.92rem; white-space:nowrap; }
[data-bs-theme="dark"] .sb-amount { color:#81c784; }

/* ================================================================
   QUICK ACTIONS
   ================================================================ */
.quick-action {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:8px; padding:16px 6px; border-radius:18px !important;
  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) !important;
  transition:transform .2s, box-shadow .2s;
  position:relative; overflow:hidden;
  animation:df-slide-up .45s ease both;
}
.quick-action::before {
  content:''; position:absolute; inset:0;
  background:linear-gradient(135deg,rgba(46,125,50,.06),transparent);
  opacity:0; transition:opacity .2s;
}
.quick-action:hover { transform:translateY(-4px); box-shadow:0 8px 26px rgba(0,0,0,.1) !important; }
.quick-action:hover::before { opacity:1; }
.quick-action:active { transform:scale(.96); }
.quick-action i { font-size:1.7rem !important; transition:transform .25s; }
.quick-action:hover i { transform:scale(1.22) rotate(-5deg); }

/* ================================================================
   LIST CARDS & ROWS
   ================================================================ */
.list-card {
  background:var(--bs-body-bg); border-radius:16px !important;
  overflow:hidden; border:none !important;
  box-shadow:0 2px 14px rgba(0,0,0,.06);
}
[data-bs-theme="dark"] .list-card { box-shadow:0 2px 14px rgba(0,0,0,.28); border:1px solid rgba(255,255,255,.06) !important; }
.list-row { transition:background .15s, transform .15s; }
a.list-row:hover, button.list-row:hover { background:var(--bs-secondary-bg); transform:translateX(3px); }
.thumb { border-radius:12px !important; transition:transform .2s; }
.list-row:hover .thumb { transform:scale(1.1); }

/* ================================================================
   BOTTOM NAVIGATION
   ================================================================ */
#bottom-nav { box-shadow:0 -4px 22px rgba(0,0,0,.09); }
[data-bs-theme="dark"] #bottom-nav { box-shadow:0 -4px 22px rgba(0,0,0,.28); }
#bottom-nav a { transition:color .2s, transform .15s; position:relative; }
#bottom-nav a.active::after {
  content:''; position:absolute; bottom:6px; left:50%;
  transform:translateX(-50%) scaleX(1);
  width:22px; height:3px; border-radius:2px;
  background:var(--bs-primary);
  animation:df-nav-dot .25s ease;
}
#bottom-nav a:not(.nav-milk):not(.nav-sell):active { transform:scale(.88); }
#bottom-nav a.active:not(.nav-milk) i { animation:df-bounce-in .35s ease; }
#bottom-nav a.nav-milk i {
  background:linear-gradient(135deg,#1565c0,#1976d2,#1e88e5);
  width:52px; height:52px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  margin-top:-22px; font-size:1.45rem;
  box-shadow:0 4px 20px rgba(21,101,192,.6);
  animation:df-pulse-ring 3s ease-in-out infinite;
  transition:transform .2s;
}
#bottom-nav a.nav-milk:active i { transform:scale(.88); }

/* ================================================================
   SIDEBAR
   ================================================================ */
.nav-menu .nav-link { transition:background .18s,border-color .18s,color .18s; }
.nav-menu .nav-link i { transition:transform .2s; }
.nav-menu .nav-link:hover i { transform:translateX(3px); }
.nav-menu .nav-link.active { font-weight:600; }

/* ================================================================
   APP TOPBAR
   ================================================================ */
.app-topbar { box-shadow:0 2px 12px rgba(0,0,0,.05); }
[data-bs-theme="dark"] .app-topbar { box-shadow:0 2px 12px rgba(0,0,0,.25); }

/* ================================================================
   CHIPS
   ================================================================ */
.chip { transition:background .18s,color .18s,border-color .18s,transform .12s; }
.chip:active { transform:scale(.94); }
.chip.active { animation:df-scale-in .18s ease; box-shadow:0 2px 10px rgba(46,125,50,.3); }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn { transition:transform .15s, box-shadow .15s; }
.btn:active { transform:scale(.97); }
.btn-success {
  background:linear-gradient(135deg,#2e7d32 0%,#43a047 100%);
  border:none; box-shadow:0 2px 10px rgba(46,125,50,.32);
}
.btn-success:hover {
  background:linear-gradient(135deg,#1b5e20 0%,#2e7d32 100%);
  transform:translateY(-1px);
  box-shadow:0 6px 20px rgba(46,125,50,.42) !important;
}
.btn-success:active { transform:translateY(0); }

/* ================================================================
   ALERTS
   ================================================================ */
.alert { border-radius:14px !important; border:none !important; }
.alert-success { background:linear-gradient(135deg,#e8f5e9,#c8e6c9); color:#1b5e20; }
.alert-warning { background:linear-gradient(135deg,#fff8e1,#ffe082); color:#e65100; }
.alert-danger  { background:linear-gradient(135deg,#ffebee,#ffcdd2); color:#b71c1c; }
.alert-info    { background:linear-gradient(135deg,#e3f2fd,#bbdefb); color:#0d47a1; }
[data-bs-theme="dark"] .alert-success { background:rgba(46,125,50,.2);  color:#81c784; border:1px solid rgba(46,125,50,.3) !important; }
[data-bs-theme="dark"] .alert-warning { background:rgba(230,81,0,.2);   color:#ffcc80; border:1px solid rgba(230,81,0,.3) !important; }
[data-bs-theme="dark"] .alert-danger  { background:rgba(183,28,28,.2);  color:#ef9a9a; border:1px solid rgba(183,28,28,.3) !important; }
[data-bs-theme="dark"] .alert-info    { background:rgba(13,71,161,.2);  color:#90caf9; border:1px solid rgba(13,71,161,.3) !important; }

/* ================================================================
   SALE TYPE BADGES & TOGGLES
   ================================================================ */
.sale-type-badge-company { background:#e3f2fd; color:#1565c0; border:1px solid #90caf9; font-weight:600; border-radius:6px; }
.sale-type-badge-local   { background:#e8f5e9; color:#2e7d32; border:1px solid #a5d6a7; font-weight:600; border-radius:6px; }
.badge-sale-company { background:#e3f2fd !important; color:#1565c0 !important; }
.badge-sale-local   { background:#e8f5e9 !important; color:#2e7d32 !important; }
.sale-type-btn { transition:background .15s, border-color .15s, transform .15s; }
.sale-type-btn:active { transform:scale(.97); }
