/*
  Pippa's Farm plugin styles — scoped to .pf-wrap (admin) and #pf-app (frontend).
  All rules below should use .pf-wrap or #pf-app prefix where conflicts are possible.
*/

/* ================================================
   Pippa's Farm — Admin + Frontend Shared CSS
   Mobile-first design
   ================================================ */

:root {
  --pf-green:       #2d6a4f;
  --pf-green-hover: #1b4332;
  --pf-green-mid:   #40916c;
  --pf-green-light: #74c69d;
  --pf-green-pale:  #d8f3dc;
  --pf-orange:      #f4a261;
  --pf-red:         #ef4444;
  --pf-red-pale:    #fef2f2;
  --pf-yellow:      #f59e0b;
  --pf-yellow-pale: #fffbeb;
  --pf-blue:        #3b82f6;
  --pf-blue-pale:   #eff6ff;
  --pf-purple:      #8b5cf6;

  --pf-bg:      #f0f4f1;
  --pf-surface: #ffffff;
  --pf-border:  #e5e7eb;

  --pf-text:        #111827;
  --pf-text-sec:    #374151;
  --pf-text-muted:  #6b7280;
  --pf-text-light:  #9ca3af;

  --pf-radius-sm: 8px;
  --pf-radius:    14px;
  --pf-radius-lg: 20px;
  --pf-radius-xl: 28px;

  --pf-shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --pf-shadow:    0 1px 3px rgba(0,0,0,.06), 0 4px 20px rgba(0,0,0,.08);
  --pf-shadow-lg: 0 8px 32px rgba(0,0,0,.14);

  --pf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --pf-transition: 150ms cubic-bezier(.4,0,.2,1);
}

/* ── Base ── */
.pf-wrap, .pf-app {
  font-family: var(--pf-font);
  color: var(--pf-text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.pf-wrap *, .pf-app * { box-sizing: border-box; }

/* ── Admin page wrapper ── */
.pf-wrap {
  max-width: 1400px;
  padding: 16px;
}
@media (min-width: 768px) { .pf-wrap { padding: 20px 24px; } }

/* ── Page header ── */
.pf-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.pf-page-header h1 {
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  font-weight: 800;
  color: var(--pf-green);
  margin: 0 0 2px;
  letter-spacing: -.4px;
}
.pf-subtitle { font-size: .85rem; color: var(--pf-text-muted); margin: 0; }

/* ── Stat Cards ── */
.pf-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 600px) { .pf-stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .pf-stats-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .pf-stats-grid { grid-template-columns: repeat(5, 1fr); } }

.pf-stat-card {
  background: var(--pf-surface);
  border-radius: var(--pf-radius);
  padding: 16px;
  box-shadow: var(--pf-shadow);
  border-left: 4px solid var(--pf-green);
  position: relative;
  overflow: hidden;
  transition: transform var(--pf-transition), box-shadow var(--pf-transition);
  word-break: break-word;
}
.pf-stat-card:hover { transform: translateY(-2px); box-shadow: var(--pf-shadow-lg); }
.pf-stat-card.orange { border-color: var(--pf-orange); }
.pf-stat-card.red    { border-color: var(--pf-red); }
.pf-stat-card.blue   { border-color: var(--pf-blue); }
.pf-stat-card.yellow { border-color: var(--pf-yellow); }
.pf-stat-card.purple { border-color: var(--pf-purple); }

.pf-stat-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--pf-text-muted);
  margin-bottom: 6px;
}
.pf-stat-value {
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 800;
  color: var(--pf-text);
  line-height: 1;
}
.pf-stat-sub {
  font-size: .73rem;
  color: var(--pf-text-muted);
  margin-top: 4px;
}

/* ── Cards ── */
.pf-card {
  background: var(--pf-surface);
  border-radius: var(--pf-radius);
  box-shadow: var(--pf-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.pf-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--pf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--pf-surface);
}
.pf-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--pf-green);
  margin: 0;
}
.pf-card-body { padding: 16px 18px; }

/* ── Grid ── */
.pf-grid-2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 768px) { .pf-grid-2 { grid-template-columns: 1fr 1fr; } }
.pf-grid-3 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 768px) { .pf-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .pf-grid-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* ── Buttons ── */
.pf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--pf-radius-sm);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--pf-transition);
  line-height: 1.3;
  font-family: var(--pf-font);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 480px) { .pf-btn { padding: 11px 16px; font-size: .85rem; } }

.pf-btn-primary   { background: var(--pf-green); color: #fff; }
.pf-btn-primary:hover { background: var(--pf-green-hover); color: #fff; }
.pf-btn-primary:active { transform: scale(.97); }

.pf-btn-secondary { background: #6b7280; color: #fff; }
.pf-btn-secondary:hover { background: #4b5563; color: #fff; }

.pf-btn-danger    { background: var(--pf-red); color: #fff; }
.pf-btn-danger:hover { background: #dc2626; color: #fff; }

.pf-btn-warning   { background: var(--pf-yellow); color: #1f2937; }
.pf-btn-warning:hover { background: #d97706; color: #fff; }

.pf-btn-outline   { background: transparent; color: var(--pf-green); border: 1.5px solid var(--pf-green); }
.pf-btn-outline:hover { background: var(--pf-green-pale); }

.pf-btn-ghost     { background: transparent; color: var(--pf-text-muted); }
.pf-btn-ghost:hover { background: var(--pf-bg); color: var(--pf-text); }

.pf-btn-sm  { padding: 6px 12px; font-size: .8rem; }
.pf-btn-xs  { padding: 4px 10px; font-size: .75rem; border-radius: 6px; }
.pf-btn-lg  { padding: 14px 28px; font-size: 1rem; border-radius: 12px; }
.pf-btn-full{ width: 100%; }
.pf-btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* FAB */
.pf-fab {
  position: fixed;
  bottom: calc(var(--pf-bottomnav-h, 64px) + 20px + env(safe-area-inset-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--pf-green);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(45,106,79,.4);
  z-index: 50;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: transform var(--pf-transition), box-shadow var(--pf-transition);
}
.pf-fab:active { transform: scale(.92); }
@media (max-width: 767px) { .pf-fab { display: flex; } }

/* ── Tables ── */
.pf-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  min-width: 500px;
}
.pf-table thead th {
  background: var(--pf-bg);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-size: .73rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--pf-text-muted);
  border-bottom: 2px solid var(--pf-border);
  white-space: nowrap;
}
.pf-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--pf-border);
  vertical-align: middle;
}
.pf-table tbody tr:hover { background: #f9fafb; }
.pf-table tbody tr:last-child td { border-bottom: none; }
.pf-table .actions { white-space: nowrap; text-align: right; }
.pf-table .actions .pf-btn { margin-left: 4px; }

/* DataTables overrides */
.dataTables_wrapper { padding: 0; }
.dataTables_wrapper .dataTables_filter { text-align: left; margin-bottom: 12px; }
.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid var(--pf-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .875rem;
  outline: none;
  margin-left: 8px;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--pf-green); }
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid var(--pf-border);
  border-radius: 6px;
  padding: 6px 8px;
}
.dataTables_wrapper .dataTables_info { font-size: .8rem; color: var(--pf-text-muted); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 6px !important;
  padding: 5px 10px !important;
  font-size: .8rem !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--pf-green) !important;
  border-color: var(--pf-green) !important;
  color: #fff !important;
}

/* ── Badges ── */
.pf-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: .2px;
}
.pf-badge-green   { background: var(--pf-green-pale); color: var(--pf-green); }
.pf-badge-red     { background: var(--pf-red-pale); color: #b91c1c; }
.pf-badge-yellow  { background: var(--pf-yellow-pale); color: #92400e; }
.pf-badge-blue    { background: var(--pf-blue-pale); color: #1d4ed8; }
.pf-badge-orange  { background: #fff7ed; color: #c2410c; }
.pf-badge-gray    { background: #f3f4f6; color: #4b5563; }
.pf-badge-purple  { background: #f5f3ff; color: #6d28d9; }

/* ── Forms ── */
.pf-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (min-width: 480px) {
  .pf-form-row { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
.pf-form-group { display: flex; flex-direction: column; gap: 5px; }
.pf-form-group label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--pf-text-sec);
  text-transform: none;
  letter-spacing: 0;
}
.pf-form-group input,
.pf-form-group select,
.pf-form-group textarea {
  padding: 11px 13px;
  border: 1.5px solid var(--pf-border);
  border-radius: var(--pf-radius-sm);
  font-size: .925rem;
  font-family: var(--pf-font);
  outline: none;
  transition: border-color var(--pf-transition), box-shadow var(--pf-transition);
  background: var(--pf-surface);
  width: 100%;
  color: var(--pf-text);
  -webkit-appearance: none;
}
.pf-form-group input:focus,
.pf-form-group select:focus,
.pf-form-group textarea:focus {
  border-color: var(--pf-green);
  box-shadow: 0 0 0 3px rgba(45,106,79,.1);
}
.pf-form-group textarea { resize: vertical; min-height: 80px; }
.pf-form-group .pf-hint { font-size: .73rem; color: var(--pf-text-muted); }
.pf-form-full { grid-column: 1 / -1; }

/* ── Tabs ── */
.pf-tabs {
  display: flex;
  border-bottom: 2px solid var(--pf-border);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pf-tabs::-webkit-scrollbar { display: none; }
.pf-tab-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  color: var(--pf-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--pf-transition);
  font-family: var(--pf-font);
  white-space: nowrap;
  flex-shrink: 0;
}
.pf-tab-btn.active { color: var(--pf-green); border-bottom-color: var(--pf-green); }
.pf-tab-pane { display: none; }
.pf-tab-pane.active { display: block; }

/* ── Modals → Bottom sheets on mobile ── */
.pf-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}
@media (min-width: 600px) { .pf-modal-overlay { align-items: center; padding: 20px; } }
.pf-modal-overlay.open { display: flex; }

.pf-modal {
  background: var(--pf-surface);
  width: 100%;
  max-height: 95dvh;
  overflow-y: auto;
  border-radius: var(--pf-radius-xl) var(--pf-radius-xl) 0 0;
  animation: pfSheetUp .25s cubic-bezier(.34,1.56,.64,1);
  position: relative;
}
@media (min-width: 600px) {
  .pf-modal {
    border-radius: var(--pf-radius-lg);
    max-width: 640px;
    max-height: 90dvh;
    animation: pfModalIn .2s ease;
  }
  .pf-modal-lg { max-width: 860px; }
}

/* Sheet handle on mobile */
.pf-modal::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--pf-border);
  border-radius: 4px;
  margin: 10px auto 0;
}
@media (min-width: 600px) { .pf-modal::before { display: none; } }

@keyframes pfSheetUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes pfModalIn {
  from { transform: translateY(-12px) scale(.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.pf-modal-header {
  padding: 14px 20px 14px;
  border-bottom: 1px solid var(--pf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--pf-surface);
  z-index: 1;
}
.pf-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--pf-green);
  margin: 0;
}
.pf-modal-close {
  background: var(--pf-bg);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--pf-text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--pf-transition);
  flex-shrink: 0;
}
.pf-modal-close:hover { background: var(--pf-red-pale); color: var(--pf-red); }

.pf-modal-body   { padding: 16px 20px; }
.pf-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--pf-border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--pf-surface);
  position: sticky;
  bottom: 0;
  /* iOS safe area */
  padding-bottom: max(14px, calc(14px + env(safe-area-inset-bottom)));
}

/* ── Toast ── */
#pf-toast-container {
  position: fixed;
  bottom: calc(var(--pf-bottomnav-h, 0px) + 24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
@media (min-width: 768px) {
  #pf-toast-container { left: auto; right: 24px; transform: none; align-items: flex-end; }
}
.pf-toast {
  background: #1f2937;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pfToastIn .25s ease;
  pointer-events: auto;
}
.pf-toast.success { background: var(--pf-green); }
.pf-toast.error   { background: var(--pf-red); }
.pf-toast.warning { background: #b45309; }
@keyframes pfToastIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Summary bar ── */
.pf-summary-bar {
  background: var(--pf-green-pale);
  border-radius: var(--pf-radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(45,106,79,.15);
}
.pf-summary-item { display: flex; flex-direction: column; gap: 2px; }
.pf-summary-item .label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--pf-green); }
.pf-summary-item .value { font-size: 1.1rem; font-weight: 800; color: var(--pf-text); }

/* ── Filters bar ── */
.pf-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.pf-filters select,
.pf-filters input[type="date"],
.pf-filters input[type="month"] {
  padding: 8px 12px;
  border: 1.5px solid var(--pf-border);
  border-radius: 8px;
  font-size: .85rem;
  outline: none;
  background: var(--pf-surface);
  -webkit-appearance: none;
}
.pf-filters select:focus,
.pf-filters input:focus { border-color: var(--pf-green); }

/* ── Dashboard charts ── */
.pf-charts-row { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 20px; }
@media (min-width: 768px) { .pf-charts-row { grid-template-columns: 1fr 1fr; } }
.pf-chart-wrap { position: relative; height: 240px; }

/* Charts full-width stacked on mobile */
@media (max-width: 768px) {
  .pf-charts-row {
    grid-template-columns: 1fr !important;
  }
  .pf-chart-wrap { height: 200px; }
}

/* Chart empty state */
.pf-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #888780;
  text-align: center;
  gap: 8px;
}
.pf-chart-empty-icon { font-size: 28px; color: #B4B2A9; }
.pf-chart-empty-text { font-size: 12px; max-width: 200px; line-height: 1.5; }

/* ── Daily log sections ── */
.pf-daily-section {
  border: 1.5px solid var(--pf-border);
  border-radius: var(--pf-radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color var(--pf-transition);
}
.pf-daily-section:has(.pf-daily-section-body[style*="block"]) { border-color: var(--pf-green); }
.pf-daily-section-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: .9rem;
  color: var(--pf-text-sec);
  background: var(--pf-bg);
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.pf-daily-section-header:hover { background: #e9ecef; }
.pf-daily-section-header:has(+ .pf-daily-section-body[style*="block"]) {
  background: #f5f7f4;
}
.pf-daily-section-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.pf-daily-section-body { padding: 16px; }
.pf-toggle-arrow { margin-left: auto; font-size: .8rem; transition: transform .2s; display: inline-block; }
.pf-toggle-arrow.open { transform: rotate(180deg); }

/* ── Photo System ── */
.pf-photo-widget { margin-top: 14px; }
.pf-photo-widget-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--pf-text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pf-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
@media (min-width: 480px) { .pf-photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); } }

.pf-photo-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--pf-bg);
  cursor: pointer;
}
.pf-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--pf-transition);
}
.pf-photo-thumb:hover img { transform: scale(1.05); }
.pf-photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: .8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--pf-transition);
}
.pf-photo-thumb:hover .pf-photo-del,
.pf-photo-thumb:focus-within .pf-photo-del { opacity: 1; }

/* Always visible on touch */
@media (hover: none) { .pf-photo-del { opacity: 1; } }

.pf-photo-pending {
  border: 2px dashed var(--pf-green);
  opacity: .8;
}
.pf-photo-pending::after {
  content: '⬆';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(255,255,255,.5);
}
.pf-photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
  color: #fff;
  font-size: .65rem;
  padding: 12px 6px 4px;
  line-height: 1.2;
}
.pf-photo-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px dashed var(--pf-green-light);
  border-radius: 10px;
  color: var(--pf-green);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: all var(--pf-transition);
  background: var(--pf-green-pale);
  min-height: 44px;
}
.pf-photo-add-btn:hover { border-color: var(--pf-green); background: #c7e9d2; }

/* Lightbox */
.pf-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 300000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.pf-lightbox.open { display: flex; }
.pf-lightbox img {
  max-width: 100%;
  max-height: 90dvh;
  object-fit: contain;
  border-radius: 8px;
}
.pf-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Activity feed ── */
.pf-activity-list { list-style: none; margin: 0; padding: 0; }
.pf-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--pf-border);
  font-size: .85rem;
}
.pf-activity-item:last-child { border-bottom: none; }
.pf-activity-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.pf-activity-dot.eggs { background: var(--pf-green-light); }
.pf-activity-dot.mortality { background: var(--pf-red); }

/* ── Progress bar ── */
.pf-progress-wrap { background: var(--pf-border); border-radius: 100px; height: 8px; overflow: hidden; }
.pf-progress-bar  { height: 100%; background: var(--pf-green); border-radius: 100px; transition: width .4s; }

/* ── Toggle ── */
.pf-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 44px; }
.pf-toggle input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--pf-green); }

/* ── Divider ── */
.pf-divider { border: none; border-top: 1px solid var(--pf-border); margin: 14px 0; }

/* ── Utilities ── */
.pf-text-green  { color: var(--pf-green); }
.pf-text-red    { color: var(--pf-red); }
.pf-text-muted  { color: var(--pf-text-muted); }
.pf-text-right  { text-align: right; }
.pf-fw-bold     { font-weight: 700; }
.pf-fw-black    { font-weight: 800; }
.pf-mt-0        { margin-top: 0; }
.pf-mb-0        { margin-bottom: 0; }

.pf-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--pf-text-muted);
  font-style: italic;
  font-size: .9rem;
}

/* ── Caretaker access table ── */
.pf-caretaker-access-table th,
.pf-caretaker-access-table td { white-space: nowrap; }
.pf-caretaker-access-table td:first-child { white-space: normal; min-width: 140px; }

/* ── Access Toggle Switch ── */
.pf-access-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.pf-access-toggle input { opacity: 0; width: 0; height: 0; }
.pf-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--pf-red);
  border-radius: 24px;
  transition: background var(--pf-transition);
}
.pf-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--pf-transition);
}
.pf-access-toggle input:checked + .pf-toggle-slider { background: var(--pf-green); }
.pf-access-toggle input:checked + .pf-toggle-slider::before { transform: translateX(20px); }

/* ================================================
   RESPONSIVE OVERRIDES — Mobile-first corrections
   ================================================ */

/* ── Prevent iOS input zoom (must be 16px on mobile) ── */
@media (max-width: 767px) {
  .pf-form-group input,
  .pf-form-group select,
  .pf-form-group textarea,
  .pf-filters select,
  .pf-filters input { font-size: 16px !important; }
}

/* ── Form rows: always 1-col in modals on small screens ── */
@media (max-width: 479px) {
  .pf-modal .pf-form-row,
  .pf-modal .pf-form-row[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  .pf-modal-footer {
    flex-direction: column-reverse;
  }
  .pf-modal-footer .pf-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Tables: horizontal scroll + readable on mobile ── */
.pf-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--pf-radius-sm);
}
@media (max-width: 600px) {
  .pf-table { font-size: .8rem; }
  .pf-table thead th { padding: 8px 10px; font-size: .68rem; }
  .pf-table tbody td { padding: 8px 10px; }
  .pf-table .actions .pf-btn { padding: 3px 7px; font-size: .7rem; }
}

/* ── Page header: stack on mobile ── */
@media (max-width: 479px) {
  .pf-page-header { flex-direction: column; align-items: flex-start; }
  .pf-page-header > *:last-child { width: 100%; }
  .pf-page-header > *:last-child .pf-btn { width: 100%; justify-content: center; }
  .pf-page-header > *:last-child > div { width: 100%; }
  .pf-page-header > *:last-child > div .pf-btn { flex: 1; }
}

/* ── Summary bar: 2-col grid on small mobile ── */
@media (max-width: 479px) {
  .pf-summary-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .pf-summary-item .value { font-size: .95rem; }
}

/* ── Filters: full-width inputs on mobile ── */
@media (max-width: 479px) {
  .pf-filters { flex-direction: column; }
  .pf-filters select,
  .pf-filters input[type="date"] { width: 100%; }
  .pf-filters .pf-btn { width: 100%; }
}

/* ── Card body: tighter on mobile ── */
@media (max-width: 479px) {
  .pf-card-body { padding: 12px 14px; }
  .pf-card-header { padding: 12px 14px; }
}

/* ── Touch targets: ensure 44px min ── */
.pf-btn, .pf-tab-btn, .pf-nav-item,
.pf-bottom-tab, .pf-modal-close {
  min-height: 44px;
}
.pf-btn-xs { min-height: 32px; }
.pf-btn-sm { min-height: 36px; }

/* ── Desktop: better use of space ── */
@media (min-width: 1024px) {
  .pf-wrap { padding: 24px 32px; }
  .pf-modal-body { padding: 20px 28px; }
  .pf-modal-footer { padding: 16px 28px; }
  .pf-form-row { gap: 16px; }
}

/* ── Desktop: stat cards in a row ── */
@media (min-width: 1200px) {
  .pf-stats-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ── Sticky submit bar (mobile daily log) ── */
.pf-sticky-submit {
  display: none;
}
@media (max-width: 768px) {
  .pf-sticky-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: 56px; /* above bottom nav */
    left: 0; right: 0;
    background: #fff;
    border-top: 1px solid #e0e0d8;
    padding: 10px 14px;
    z-index: 900;
    gap: 10px;
    box-shadow: 0 -2px 8px rgba(0,0,0,.06);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .pf-sticky-progress { font-size: .78rem; color: #6b7280; flex: 1; }
  .pf-sticky-btn { padding: 10px 18px; font-size: .875rem; }
}

/* ── Single column forms on mobile ── */
@media (max-width: 768px) {
  .pf-form-row,
  .pf-form-row[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  .pf-daily-section .pf-form-row .pf-form-group textarea {
    min-height: 70px;
  }
}

/* ── Mortality info callout ── */
.pf-mort-callout {
  background: #E1F5EE;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #085041;
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Egg Production Card List (mobile) ── */
.pf-egg-cards { display: none; }
@media (max-width: 768px) {
  .pf-table-wrap .pf-dt { display: none; }
  .pf-egg-cards { display: block; padding: 4px 0; }
}
.pf-egg-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow .15s;
}
.pf-egg-card:active { box-shadow: 0 2px 12px rgba(0,0,0,.1); }
.pf-egg-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.pf-egg-card-date { font-size: .8rem; color: #6b7280; font-weight: 500; }
.pf-egg-card-batch {
  background: #E1F5EE;
  color: #0F6E56;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
}
.pf-egg-card-net { font-size: 28px; font-weight: 500; color: #111827; line-height: 1.1; }
.pf-egg-card-netlabel { font-size: 10px; color: #9ca3af; margin-bottom: 8px; }
.pf-egg-card-bottom { font-size: .78rem; color: #6b7280; display: flex; flex-wrap: wrap; gap: 4px; }
.pf-egg-card-expand { margin-top: 10px; padding-top: 10px; border-top: 1px solid #f3f4f6; font-size: .8rem; }
.pf-egg-card-sizes { display: flex; gap: 8px; flex-wrap: wrap; color: #374151; margin-bottom: 4px; }
.pf-egg-card-notes { color: #6b7280; font-style: italic; }
.pf-egg-card-nodata { color: #9ca3af; font-style: italic; }

/* ── Egg Filter Desktop/Mobile toggle ── */
.pf-filter-desktop { display: block; }
.pf-filter-mobile-btn { display: none; }
@media (max-width: 768px) {
  .pf-filter-desktop { display: none; }
  .pf-filter-mobile-btn { display: block; margin-bottom: 12px; }
}

/* ── Filter Bottom Sheet ── */
.pf-filter-sheet-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 9998;
}
.pf-filter-sheet-overlay.open { display: block; }
.pf-filter-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 12px 20px 24px;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.pf-filter-sheet.open { transform: translateY(0); }
.pf-filter-sheet-handle { width: 36px; height: 4px; background: #e5e7eb; border-radius: 4px; margin: 0 auto 16px; }
.pf-filter-sheet-title { font-size: 1rem; font-weight: 700; color: #0F6E56; margin-bottom: 16px; }

/* ── Farm Logo uploader (Settings) ── */
.pf-logo-uploader { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.pf-logo-preview {
  width: 64px; height: 64px;
  border: 1.5px solid var(--pf-border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0; background: #fff;
}
.pf-logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.pf-logo-placeholder { font-size: 1.8rem; }
.pf-logo-actions { display: flex; flex-direction: column; gap: 6px; }
