/* ===================================================================
   PATUSI Farm Management Platform - App styles
   Light theme = default (matches the original approved design).
   Dark theme overrides via [data-theme="dark"] on <html>.
=================================================================== */

:root,
[data-theme="light"] {
  --patusi-primary: #1B5E20;
  --patusi-secondary: #2E7D32;
  --patusi-accent: #F9A825;
  --patusi-bg: #F7F7F5;
  --patusi-surface: #FFFFFF;
  --patusi-text: #1F2A1F;
  --patusi-text-muted: #5B6B5B;
  --patusi-border: #E1E4DD;
  --patusi-icon-border: rgba(27, 94, 32, 0.22);
  --patusi-nav-bg: #FFFFFF;
  --patusi-footer-bg: #12321A;
  --patusi-footer-text: #D9E5DA;
  --patusi-shadow: rgba(27, 94, 32, 0.10);
}

[data-theme="dark"] {
  --patusi-primary: #4CAF50;
  --patusi-secondary: #66BB6A;
  --patusi-accent: #FFC947;
  --patusi-bg: #0F1512;
  --patusi-surface: #1A211D;
  --patusi-text: #EAF0EA;
  --patusi-text-muted: #A9B7A9;
  --patusi-border: #2A342E;
  --patusi-icon-border: rgba(76, 175, 80, 0.45);
  --patusi-nav-bg: #14201A;
  --patusi-footer-bg: #0A140D;
  --patusi-footer-text: #B9C9B9;
  --patusi-shadow: rgba(0, 0, 0, 0.35);
}

* { transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; }

body {
  background-color: var(--patusi-bg);
  color: var(--patusi-text);
  font-family: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Poppins", "Inter", sans-serif;
  letter-spacing: -0.01em;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  font-size: 1.25rem;
  line-height: 1;
}

/* ---------------------------------------------------------------
   NAVBAR
--------------------------------------------------------------- */
.navbar-patusi {
  background-color: var(--patusi-nav-bg);
  border-bottom: 1px solid var(--patusi-border);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

/* ---------------------------------------------------------------
   LOGO - the source PNG has a solid white/cream background baked
   in (not transparent), which looks like a sharp white rectangle
   on dark theme. Apply rounded corners everywhere it appears.
--------------------------------------------------------------- */
.patusi-logo {
  border-radius: 12px;
}
.footer-logo {
  height: 56px;
  width: auto;
  background: #fff;
  padding: 4px;
}

.navbar-patusi .navbar-brand img {
  height: 46px;
  width: auto;
}

.nav-link {
  color: var(--patusi-text);
  font-weight: 500;
}
.nav-link:hover { color: var(--patusi-primary); }

/* ---------------------------------------------------------------
   CUSTOM HAMBURGER (replaces Bootstrap's default toggler icon)
--------------------------------------------------------------- */
.navbar-toggler-custom {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: var(--patusi-surface);
  box-shadow: 0 2px 6px var(--patusi-shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.navbar-toggler-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--patusi-shadow);
}
.navbar-toggler-custom .hamburger-line {
  display: block;
  height: 2px;
  width: 20px;
  margin: 0 auto;
  background-color: var(--patusi-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.navbar-toggler-custom.is-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.navbar-toggler-custom.is-open .hamburger-line:nth-child(2) {
  opacity: 0;
}
.navbar-toggler-custom.is-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Spacing between Log In and Register (both mobile stacked + desktop) */
.nav-auth-group { margin-top: 0.5rem; }
@media (min-width: 992px) {
  .nav-auth-group { margin-top: 0; margin-left: 0.5rem; }
}

/* ---------------------------------------------------------------
   THEME TOGGLE BUTTON
--------------------------------------------------------------- */
.theme-toggle-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: none;
  background: var(--patusi-surface);
  box-shadow: 0 2px 6px var(--patusi-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--patusi-primary);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.theme-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--patusi-shadow);
}
.theme-toggle-btn .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-toggle-btn .theme-icon-light { display: none; }
[data-theme="dark"] .theme-toggle-btn .theme-icon-dark { display: inline; }

/* ---------------------------------------------------------------
   BUTTONS
--------------------------------------------------------------- */
.btn-patusi-primary {
  background-color: var(--patusi-primary);
  border-color: var(--patusi-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--patusi-shadow);
}
.btn-patusi-primary:hover {
  filter: brightness(0.92);
  color: #fff;
}

.btn-patusi-outline {
  background-color: transparent;
  border: 1.5px solid var(--patusi-primary);
  color: var(--patusi-primary);
  font-weight: 600;
}
.btn-patusi-outline:hover {
  background-color: var(--patusi-primary);
  color: #fff;
}

/* ---------------------------------------------------------------
   HERO
--------------------------------------------------------------- */
.hero-section {
  background: linear-gradient(135deg, color-mix(in srgb, var(--patusi-primary) 8%, var(--patusi-bg)) 0%, var(--patusi-bg) 65%);
  border-bottom: 1px solid var(--patusi-border);
}

.hero-logo {
  max-width: 260px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 28px var(--patusi-shadow));
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  margin-top: 1.75rem;
}
.trust-row .trust-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--patusi-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.trust-row .material-symbols-outlined {
  color: var(--patusi-primary);
  font-size: 1.1rem;
}

/* ---------------------------------------------------------------
   SECTION HEADINGS
--------------------------------------------------------------- */
.section-eyebrow {
  color: var(--patusi-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

/* ---------------------------------------------------------------
   FEATURE CARDS
--------------------------------------------------------------- */
.feature-card {
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  border-radius: 1rem;
  padding: 1.75rem;
  height: 100%;
  transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}
.feature-card:hover {
  box-shadow: 0 0.75rem 1.75rem var(--patusi-shadow);
  transform: translateY(-3px);
}

.feature-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--patusi-primary) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.feature-icon-circle .material-symbols-outlined {
  font-size: 1.6rem;
  color: var(--patusi-primary);
}

/* ---------------------------------------------------------------
   PRICING CARDS
--------------------------------------------------------------- */
.pricing-card {
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  border-radius: 1rem;
  padding: 1.85rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.pricing-card.pricing-highlight {
  border: 2px solid var(--patusi-primary);
  box-shadow: 0 0.75rem 2rem var(--patusi-shadow);
}
.pricing-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--patusi-primary);
  font-family: "Poppins", sans-serif;
}

/* ---------------------------------------------------------------
   FOOTER
--------------------------------------------------------------- */
.footer-patusi {
  background-color: var(--patusi-footer-bg);
  color: var(--patusi-footer-text);
}
.footer-patusi a {
  color: var(--patusi-footer-text);
  text-decoration: none;
}
.footer-patusi a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* ---------------------------------------------------------------
   FLOATING SUPPORT CHAT BUTTON
--------------------------------------------------------------- */
.support-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--patusi-primary);
  color: #fff;
  border: none;
  box-shadow: 0 8px 22px var(--patusi-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1050;
  transition: transform 0.15s ease;
}
.support-fab:hover { transform: scale(1.06); }
.support-fab .material-symbols-outlined { font-size: 1.7rem; }

.support-fab-toast {
  position: fixed;
  right: 1.25rem;
  bottom: 5.5rem;
  max-width: 260px;
  background: var(--patusi-surface);
  color: var(--patusi-text);
  border: 1px solid var(--patusi-border);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  box-shadow: 0 8px 22px var(--patusi-shadow);
  z-index: 1050;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.support-fab-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------------------------------------------------------------
   PASSWORD SHOW/HIDE TOGGLE
--------------------------------------------------------------- */
.password-input-wrapper {
  position: relative;
}
.password-input-wrapper .form-control {
  padding-right: 2.6rem;
}
.password-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--patusi-text-muted);
  display: flex;
  align-items: center;
}
.password-toggle-btn:hover {
  color: var(--patusi-primary);
}

/* ---------------------------------------------------------------
   AUTH FORMS (login/register) + theme-aware Bootstrap form controls
--------------------------------------------------------------- */
.auth-card {
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  border-radius: 1rem;
  box-shadow: 0 0.5rem 1.5rem var(--patusi-shadow);
  padding: 2rem;
}
@media (min-width: 576px) {
  .auth-card { padding: 2.5rem; }
}

.form-label {
  color: var(--patusi-text);
}

.form-control {
  background-color: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  color: var(--patusi-text);
}
.form-control:focus {
  background-color: var(--patusi-surface);
  color: var(--patusi-text);
  border-color: var(--patusi-primary);
  box-shadow: 0 0 0 0.2rem var(--patusi-shadow);
}
.form-control::placeholder {
  color: var(--patusi-text-muted);
}

.form-select {
  background-color: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  color: var(--patusi-text);
}

/* ---------------------------------------------------------------
   BOOTSTRAP TABLE + MODAL DARK-MODE FIX (root cause of the white
   card/document backgrounds reported on Flocks and elsewhere).
   Bootstrap 5.3 drives .table and .modal-content backgrounds from
   --bs-table-bg / --bs-modal-bg, both of which default to
   --bs-body-bg - a fixed white that Bootstrap sets once and never
   changes, because Bootstrap only reacts to ITS OWN data-bs-theme
   attribute, which this app never sets (we use our own [data-theme]
   instead). That left every <table> cell and every modal hardcoded
   to white no matter which of our themes was active - not a bug on
   any one page, a gap in every table and modal app-wide (flocks,
   sales/expenses, reports, customers/suppliers, admin screens,
   receipts, the feed calculator, breeding records, all of it).
   Fixed the same way .form-control above already is: override with
   our own theme variables, which already flip correctly between
   light and dark, instead of Bootstrap's fixed ones.
--------------------------------------------------------------- */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--patusi-text);
  --bs-table-border-color: var(--patusi-border);
  --bs-table-striped-bg: var(--patusi-bg);
  --bs-table-striped-color: var(--patusi-text);
  --bs-table-active-bg: var(--patusi-bg);
  --bs-table-active-color: var(--patusi-text);
  --bs-table-hover-bg: var(--patusi-bg);
  --bs-table-hover-color: var(--patusi-text);
  color: var(--patusi-text);
}
.table thead th {
  color: var(--patusi-text-muted);
  border-bottom-color: var(--patusi-border);
}

/* ---------------------------------------------------------------
   VERTICAL COLUMN DIVIDERS - every table in the app (flocks, ponds,
   batches, animals, breeding, inventory, the feed calculator, saved
   formulations, reports, receipts) shares this one .table component,
   so adding the divider here applies everywhere at once rather than
   needing a per-page fix. Right border only, and skipped on the
   last cell in a row, so there's no doubled-up line at the table's
   own outer edge. Uses the same --patusi-border variable every
   other border in the app already uses, so it's automatically
   correct in both Light and Dark Mode with no new color introduced.
--------------------------------------------------------------- */
.table thead th:not(:last-child),
.table tbody td:not(:last-child) {
  border-right: 1px solid var(--patusi-border);
}

.modal-content {
  --bs-modal-bg: var(--patusi-surface);
  --bs-modal-color: var(--patusi-text);
  background-color: var(--patusi-surface);
  color: var(--patusi-text);
}
.modal-header,
.modal-footer {
  border-color: var(--patusi-border);
}
.btn-close {
  filter: var(--patusi-btn-close-filter, none);
}
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
.form-select:focus {
  border-color: var(--patusi-primary);
  box-shadow: 0 0 0 0.2rem var(--patusi-shadow);
}

.form-check-label {
  color: var(--patusi-text);
}
.form-check-label a {
  color: var(--patusi-primary);
}

/* ---------------------------------------------------------------
   LEGAL PAGES (Terms / Privacy)
--------------------------------------------------------------- */
.legal-content p,
.legal-content li {
  color: var(--patusi-text-muted);
  line-height: 1.7;
}
.legal-content h2 {
  color: var(--patusi-text);
}
.legal-content a {
  color: var(--patusi-primary);
}

/* ---------------------------------------------------------------
   DASHBOARD
--------------------------------------------------------------- */
.dash-stat-card {
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  border-radius: 1rem;
  padding: 1.25rem;
  height: 100%;
  min-width: 0;          /* lets the card shrink inside its grid column instead of being pushed wider by a long figure */
  overflow: hidden;      /* last-resort guard: nothing can ever paint outside the card */
}
.dash-stat-card .fw-bold.h1, .dash-stat-card .fw-bold.h2, .dash-stat-card .fw-bold.h3,
.dash-stat-card .fw-bold.h4, .dash-stat-card .fw-bold.h5, .dash-stat-card .fw-bold.h6,
.dash-stat-card .pricing-price {
  max-width: 100%;
  line-height: 1.25;
}
@media (max-width: 575.98px) {
  .dash-stat-card { padding: 1rem; }
}
.dash-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--patusi-primary) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.dash-stat-icon .material-symbols-outlined {
  color: var(--patusi-primary);
  font-size: 1.4rem;
}
.dash-stat-card-link {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  color: var(--patusi-text);
}
.dash-stat-card-link:hover {
  box-shadow: 0 0.5rem 1.25rem var(--patusi-shadow);
  transform: translateY(-2px);
}

.trial-banner {
  background: color-mix(in srgb, var(--patusi-accent) 14%, var(--patusi-surface));
  border: 1px solid var(--patusi-accent);
  border-radius: 0.85rem;
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--patusi-text);
}
.trial-banner .material-symbols-outlined {
  color: var(--patusi-accent);
}
.trial-banner a { color: var(--patusi-primary); }

.roadmap-card {
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  border-radius: 1rem;
  padding: 1.5rem;
}
.roadmap-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border: 1px dashed var(--patusi-border);
  border-radius: 0.65rem;
  color: var(--patusi-text-muted);
}
.roadmap-item .material-symbols-outlined {
  color: var(--patusi-text-muted);
  font-size: 1.15rem;
}

/* ---------------------------------------------------------------
   SIMPLE PROPORTIONAL BAR CHARTS (Reports page category breakdowns)
--------------------------------------------------------------- */
.bar-track {
  background: var(--patusi-border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--patusi-primary);
  border-radius: 999px;
}
.bar-fill-danger {
  background: #B71C1C;
}

/* ---------------------------------------------------------------
   RESPONSIVE TABLES (Section 44) - unchanged behaviour, theme-aware
--------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .table-responsive-cards thead { display: none; }
  .table-responsive-cards tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--patusi-border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--patusi-surface);
  }
  .table-responsive-cards tbody td {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: 0.35rem 0;
  }
  /* Cancels the vertical column divider above once stacked into
     cards - a label:value pair isn't "two columns" the same way a
     wide table's cells are, so a divider here would just look like
     a stray line between a field's label and its value. Matches the
     divider rule's specificity exactly so this wins on source order
     without needing !important. */
  .table-responsive-cards tbody td:not(:last-child) {
    border-right: none;
  }
  .table-responsive-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--patusi-text-muted);
    margin-right: 1rem;
  }
}

/* ---------------------------------------------------------------
   PLATFORM ADMIN AREA (Phase 15) - sub-navigation tabs, small
   metric tiles, and filter bars used across /admin/*.php screens.
--------------------------------------------------------------- */
.admin-subnav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--patusi-text-muted);
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  text-decoration: none;
}

.admin-subnav-link:hover {
  color: var(--patusi-primary);
  border-color: var(--patusi-icon-border);
}

.admin-subnav-link.active {
  color: #fff;
  background: var(--patusi-primary);
  border-color: var(--patusi-primary);
}

.admin-filter-bar {
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  border-radius: 0.75rem;
  padding: 1rem;
}

.admin-detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--patusi-text-muted);
  margin-bottom: 0.15rem;
}

.admin-detail-value {
  font-weight: 600;
  margin-bottom: 0;
}

/* ---------------------------------------------------------------
   PRINTABLE RECEIPTS (Phase 16) - pages/receipt.php reuses the
   normal site chrome on-screen, but printing (or "Save as PDF")
   should show only the receipt itself.
--------------------------------------------------------------- */
.receipt-print-area {
  background: var(--patusi-surface);
  border: 1px solid var(--patusi-border);
  border-radius: 0.75rem;
  padding: 2rem;
}

@media print {
  .navbar-patusi,
  .footer-patusi,
  .support-fab,
  .support-fab-toast,
  .admin-subnav,
  .no-print,
  .alert {
    display: none !important;
  }
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .receipt-print-area {
    border: none !important;
    padding: 0 !important;
  }
  /* The screen preview follows whichever theme is active (see the
     .table dark-mode fix above), but the physical printout/PDF must
     always be black-on-white regardless of that - this overrides
     the theme variables specifically for print output only, so a
     receipt printed while in Dark Mode still comes out readable on
     paper instead of light-grey text that won't show up. */
  .table, .receipt-print-area .table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #000 !important;
    --bs-table-border-color: #dee2e6 !important;
  }
  /* Same reasoning as the table variables above - the vertical
     column divider added below uses --patusi-border directly rather
     than a --bs-* variable, so it needs its own explicit print-safe
     override or a receipt printed from Dark Mode would show
     near-invisible dark-grey column lines on white paper. */
  .table thead th, .table tbody td {
    border-right-color: #dee2e6 !important;
  }
}

/* ---------------------------------------------------------------
   FEED FORMULATION CALCULATOR (Phase 19) - saved formulations use
   a native <details> element per row so the ingredient breakdown
   can expand without any extra JS wiring.
--------------------------------------------------------------- */
.feed-formulation-details {
  border: 1px solid var(--patusi-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

.feed-formulation-details summary {
  cursor: pointer;
  list-style: none;
}

.feed-formulation-details summary::-webkit-details-marker {
  display: none;
}

.feed-formulation-details summary::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.15s ease;
  color: var(--patusi-text-muted);
}

.feed-formulation-details[open] summary::before {
  transform: rotate(90deg);
}

/* ---------------------------------------------------------------
   FULLY RESPONSIVE LANDING PAGE - fits every screen width and
   stacks cleanly on phones (no sideways scrolling, nothing cut off).
--------------------------------------------------------------- */
/* overflow-x on <html> only: putting it on <body> too would break the sticky navbar */
html { max-width: 100%; overflow-x: hidden; }
body { max-width: 100%; }
img, svg, video { max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, p, li, a { overflow-wrap: anywhere; }

.hero-title { font-size: clamp(1.65rem, 5.2vw + 0.4rem, 2.5rem); line-height: 1.2; }
.hero-lead  { font-size: clamp(1rem, 1.6vw + 0.65rem, 1.1rem); }
.cta-title  { font-size: clamp(1.4rem, 4vw + 0.4rem, 2rem); }

/* Tablets and below: centre the hero and put the logo under the text */
@media (max-width: 991.98px) {
  .hero-section { text-align: center; }
  .hero-section .trust-row { justify-content: center; }
  .hero-section .hero-cta { align-items: center; }
  .hero-logo { max-width: 200px; }
}

/* Phones: full-width buttons, trust items stacked, tighter spacing */
@media (max-width: 575.98px) {
  .hero-section { padding-top: 1.5rem !important; padding-bottom: 2rem !important; }
  .hero-section .hero-cta .btn { width: 100%; }
  .hero-section .trust-row { flex-direction: column; align-items: center; gap: 0.75rem; }
  .hero-logo { max-width: 150px; }
  .feature-card { padding: 1.25rem; }
  section.py-5 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
  .container { padding-left: 1rem; padding-right: 1rem; }
  .footer-patusi .row > div { text-align: left; }
}

/* ---------------------------------------------------------------
   DESKTOP LAYOUT, FULL SCREEN
   On big screens the page uses the whole width instead of leaving wide
   empty margins; on phones/tablets the 1200px desktop layout is scaled
   to fit by the viewport tag in includes/header.php.
--------------------------------------------------------------- */
@media (min-width: 1200px) {
  .container { max-width: min(1600px, 96vw); }
}
body { min-height: 100vh; }

/* ---------------------------------------------------------------
   NO ZOOM WHILE TYPING
   Phone browsers zoom the page when you tap a box whose text is under
   16px. Every entry box is therefore at least 16px on phones/tablets,
   and tapping never changes the page zoom.
--------------------------------------------------------------- */
@media (max-width: 991.98px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]),
  select,
  textarea,
  .form-control,
  .form-control-sm,
  .form-select,
  .form-select-sm {
    font-size: 16px !important;
  }
}
input, select, textarea, button { touch-action: manipulation; }

/* Desktop mode everywhere: from the 1024px desktop width up, containers use almost the whole screen */
@media (min-width: 992px) {
  .container { max-width: min(1600px, 97vw); }
}

/* Support mode banner (admin viewing a farm read-only) */
.support-banner {
  position: sticky; top: 0; z-index: 2000;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .55rem 1rem;
  background: #FFC107; color: #1b1b1b; font-size: .9rem;
  border-bottom: 2px solid #b38600;
}

/* Feed calculator: keep the totals (protein %, total cost, total kg) in view while adding ingredients */
.feed-results-bar {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--patusi-surface, #fff);
  border-top: 1px solid var(--patusi-border, #dee2e6);
  padding: .75rem 0 .5rem;
  box-shadow: 0 -6px 12px -10px rgba(0, 0, 0, .35);
}


/* ---------------------------------------------------------------
   "CLICK HERE" GLOW
   Every clickable card/button on the dashboard (Poultry, Catfish,
   Livestock, Inventory, Feed calculator, Sales & expenses, Reports,
   Team, Activity log, Settings, Billing, Customers, Suppliers) gives
   off a soft green light that pulses at its edges, so new users can
   see at a glance where to tap. It holds steady while hovered/focused
   and stays still for people who prefer reduced motion.
--------------------------------------------------------------- */
@keyframes patusiGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0), 0 0 6px 1px rgba(76, 175, 80, .35);
    border-color: rgba(76, 175, 80, .55);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(76, 175, 80, .20), 0 0 18px 4px rgba(76, 175, 80, .60);
    border-color: rgba(76, 175, 80, 1);
  }
}
.dash-stat-card-link,
.dash-link-card,
.dash-glow {
  animation: patusiGlow 2.2s ease-in-out infinite;
  border: 1px solid rgba(76, 175, 80, .6);
}
.dash-link-card { transition: transform .15s ease; }
.dash-stat-card-link:hover, .dash-stat-card-link:focus-visible,
.dash-link-card:hover, .dash-link-card:focus-within,
.dash-glow:hover, .dash-glow:focus-visible {
  animation: none;
  box-shadow: 0 0 0 4px rgba(76, 175, 80, .25), 0 0 22px 5px rgba(76, 175, 80, .65);
  border-color: rgba(76, 175, 80, 1);
}
.dash-link-card:hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) {
  .dash-stat-card-link, .dash-link-card, .dash-glow {
    animation: none;
    box-shadow: 0 0 10px 2px rgba(76, 175, 80, .45);
  }
}


/* ---------------------------------------------------------------
   "CLICK HERE" GLOW ON EVERY PAGE
   Three levels so the page never turns into a light show:
     1. Main action buttons (green, e.g. Add flock, Save, Sell, Record, Register): soft pulse.
     2. Other buttons (outlined, e.g. Go Back, Install App, See Pricing, Back links): fainter, slower pulse.
     3. Small row buttons inside lists/tables (Edit, Manage...): a steady faint edge light, no pulsing,
        so a long list doesn't flash.
   Red/danger buttons never glow. Hover/focus: a steady brighter light. Reduced motion: no pulsing.
--------------------------------------------------------------- */
@keyframes patusiGlowSoft {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0), 0 0 5px 1px rgba(76, 175, 80, .30); }
  50%      { box-shadow: 0 0 0 3px rgba(76, 175, 80, .16), 0 0 14px 3px rgba(76, 175, 80, .50); }
}
@keyframes patusiGlowFaint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0), 0 0 3px 0 rgba(76, 175, 80, .22); }
  50%      { box-shadow: 0 0 0 2px rgba(76, 175, 80, .10), 0 0 9px 2px rgba(76, 175, 80, .38); }
}

.btn-patusi-primary:not(:disabled):not(.disabled) {
  animation: patusiGlowSoft 2.6s ease-in-out infinite;
}
.btn-patusi-outline:not(:disabled):not(.disabled) {
  animation: patusiGlowFaint 3.4s ease-in-out infinite;
}

/* small buttons in tables / record lists: steady, not pulsing */
table .btn-patusi-outline, table .btn-patusi-primary,
.record-actions .btn-patusi-outline, .modal .btn-patusi-outline {
  animation: none;
  box-shadow: 0 0 0 1px rgba(76, 175, 80, .35), 0 0 7px rgba(76, 175, 80, .30);
}

/* admin tabs: faint edge light so they read as tappable */
.admin-subnav-link:not(.active) {
  box-shadow: 0 0 0 1px rgba(76, 175, 80, .30), 0 0 7px rgba(76, 175, 80, .22);
}

/* hover / keyboard focus: steady and brighter */
.btn-patusi-primary:not(:disabled):hover, .btn-patusi-primary:not(:disabled):focus-visible,
.btn-patusi-outline:not(:disabled):hover, .btn-patusi-outline:not(:disabled):focus-visible,
.admin-subnav-link:hover {
  animation: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, .25), 0 0 18px 4px rgba(76, 175, 80, .60);
}

@media (prefers-reduced-motion: reduce) {
  .btn-patusi-primary, .btn-patusi-outline {
    animation: none !important;
    box-shadow: 0 0 8px 1px rgba(76, 175, 80, .40);
  }
}
@media print {
  *, *::before, *::after { animation: none !important; box-shadow: none !important; }
}


/* ---------------------------------------------------------------
   JUST SAVED: land on the list where the new record is and flash it
--------------------------------------------------------------- */
[id^="sec-"], [id^="rec-"] { scroll-margin-top: 90px; }
@keyframes savedFlash {
  0%   { box-shadow: 0 0 0 4px rgba(76, 175, 80, .75), 0 0 28px 6px rgba(76, 175, 80, .65); }
  100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0), 0 0 0 0 rgba(76, 175, 80, 0); }
}
.just-saved { animation: savedFlash 4.5s ease-out; border-radius: 1rem; }
.just-saved-row > td { background: rgba(76, 175, 80, .20) !important; transition: background 1s ease; }
@media (prefers-reduced-motion: reduce) {
  .just-saved { animation: none; box-shadow: 0 0 0 3px rgba(76, 175, 80, .6); }
}


/* ---------------------------------------------------------------
   PRINT / SAVE AS PDF - the whole app (reports, receipts, and any page printed from the browser)
   1. ALWAYS a normal black-on-white document, whatever theme (light or dark) is on screen.
   2. The page uses the whole printable width (the screen "container" width limit is removed: Bootstrap
      caps it at 540px on paper, which left about 25mm of dead space down each side).
   3. Content FLOWS: it fills page 1, then continues on page 2, 3... Big boxes (cards, tables, whole
      columns) may split across a page break, so no big gap is left behind. Only SMALL units are
      kept in one piece: a table row, a stat box, a chart, a list line, a bar. A heading always stays
      with the content that follows it. A table that runs onto the next page repeats its header row.
   4. Compact but readable: the same font sizes, with tighter padding and spacing between blocks.
   Page margins and the footer (company name + "Page X of Y") are set once, below.
--------------------------------------------------------------- */
@page { margin: 10mm 10mm 14mm 10mm; }
@page {
  @bottom-left  { content: "PATUSI Integrated Farming"; font: 8pt Inter, Arial, sans-serif; color: #555; }
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt Inter, Arial, sans-serif; color: #555; }
}

@media print {
  /* ---- 1. paper look: never the dark theme ---- */
  :root, [data-theme="dark"], [data-theme="light"] {
    --patusi-primary: #1B5E20;
    --patusi-secondary: #2E7D32;
    --patusi-accent: #F9A825;
    --patusi-bg: #FFFFFF;
    --patusi-surface: #FFFFFF;
    --patusi-text: #000000;
    --patusi-text-muted: #444444;
    --patusi-border: #BBBBBB;
    --patusi-nav-bg: #FFFFFF;
    --patusi-shadow: transparent;
  }
  html, body { background: #fff !important; color: #000 !important; height: auto !important; min-height: 0 !important; }
  .roadmap-card,
  .dash-stat-card {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #999 !important;
    box-shadow: none !important;
  }
  h1, h2, h3, h4, h5, h6, p, td, th, span, div, li { color: #000; }
  .text-secondary, .text-muted { color: #444 !important; }
  .text-success { color: #1B5E20 !important; }
  .text-danger  { color: #B71C1C !important; }
  .section-eyebrow { color: #1B5E20 !important; }

  /* ---- 2. use the whole printable width, no screen padding around the content ---- */
  .container, .container-fluid {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  section, main, section[class*="py-"] {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  /* ---- 3. flow across pages: big boxes may split, small units never do ---- */
  .row, .row > *, .roadmap-card, .table-responsive, .card, section, main, .container,
  .receipt-print-area {
    break-inside: auto !important;
    page-break-inside: auto !important;
  }
  /* Bootstrap "rows":
     - a row of SMALL stat boxes becomes a tidy grid (equal heights; each box is never split);
     - every other row (it holds cards, tables, text) is printed as plain STACKED, full-width blocks.
       Block flow splits across pages reliably in every browser, whereas side-by-side flex columns
       keep a tall box in one piece and push it to the next page (that is what left half-empty pages). */
  .row:not(:has(.dash-stat-card)),
  .row:has(.roadmap-card, .card, .table-responsive) {
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
  }
  .row:not(:has(.dash-stat-card)) > *,
  .row:has(.roadmap-card, .card, .table-responsive) > * {
    width: auto !important;
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-top: 0 !important;
  }
  .row:not(:has(.dash-stat-card)) > * + *,
  .row:has(.roadmap-card, .card, .table-responsive) > * + * { margin-top: 0.75rem !important; }
  .row:not(:has(.dash-stat-card)) .h-100,
  .row:has(.roadmap-card, .card, .table-responsive) .h-100 { height: auto !important; }

  .row:has(.dash-stat-card):not(:has(.roadmap-card, .card, .table-responsive)) {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));   /* 2 across on portrait A4, 4 across on landscape */
    gap: 0.6rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;          /* (the bottom margin, e.g. .mb-4, is kept as the gap to the next block) */
  }
  .row:has(.dash-stat-card):not(:has(.roadmap-card, .card, .table-responsive)) > * {
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .dash-stat-card, tr, li, img, canvas, .badge, .roadmap-card .mb-2, .roadmap-card .mb-1 {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    break-after: avoid;
    page-break-after: avoid;
  }
  p { orphans: 3; widows: 3; }
  thead { display: table-header-group; }   /* long tables repeat their header on each page */
  tfoot { display: table-row-group; }      /* totals appear once, at the end of the table */
  /* charts keep their shape but are capped at 62mm tall, so a chart never becomes a page-sized block that cannot fit
     in the space left on a page (on landscape paper an uncapped chart is much taller than it is useful) */
  canvas {
    display: block;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 62mm !important;
    margin-left: auto;
    margin-right: auto;
  }
  .roadmap-card {
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;           /* a card that continues on the next page keeps its border and padding */
  }

  /* ---- 4. compact but readable: same font sizes, tighter padding and gaps ---- */
  .table-responsive { overflow: visible !important; }
  .table { width: 100% !important; }
  .table > :not(caption) > * > * { padding: 0.3rem 0.5rem !important; }
  .table td, .table th { overflow-wrap: anywhere; }
  .roadmap-card { padding: 0.9rem 1rem !important; }
  .dash-stat-card { padding: 0.7rem 0.9rem !important; }
  .mb-4 { margin-bottom: 1rem !important; }
  .mb-3 { margin-bottom: 0.65rem !important; }
  .mt-4 { margin-top: 1rem !important; }
  .row.g-4 { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
  .row.g-3 { --bs-gutter-x: 0.75rem; --bs-gutter-y: 0.75rem; }
}
