/* ============================================================
   POULTRY MANAGER
   Complete Responsive Application Stylesheet
   Version: 4.0
   Designed for the existing index.html
   ============================================================ */
/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
    color-scheme: light;
    --pm-primary: #1f6b45;
    --pm-primary-hover: #185538;
    --pm-primary-soft: #e8f4ec;
    --pm-primary-border: #c6e3d0;
    --pm-bg: #f4f7f4;
    --pm-surface: #ffffff;
    --pm-surface-soft: #f8faf8;
    --pm-surface-muted: #eef3ef;
    --pm-text: #1c2c23;
    --pm-text-secondary: #637168;
    --pm-text-muted: #859087;
    --pm-border: #e1e9e2;
    --pm-border-strong: #d2ddd4;
    --pm-success: #218451;
    --pm-success-soft: #e6f5eb;
    --pm-warning: #b7791f;
    --pm-warning-soft: #fff4d8;
    --pm-danger: #c43e43;
    --pm-danger-hover: #a72d32;
    --pm-danger-soft: #fdebec;
    --pm-info: #2768b2;
    --pm-info-soft: #eaf2fd;
    --pm-radius-sm: 10px;
    --pm-radius-md: 15px;
    --pm-radius-lg: 20px;
    --pm-radius-xl: 26px;
    --pm-shadow-sm:
        0 2px 8px rgba(24, 48, 32, 0.035);
    --pm-shadow-md:
        0 6px 20px rgba(24, 48, 32, 0.055);
    --pm-shadow-lg:
        0 12px 34px rgba(24, 48, 32, 0.09);
    --pm-content-width: 1120px;
    --pm-page-gutter: 24px;
    --pm-transition:
        180ms ease;
    --pm-font:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    /* Compatibility aliases */
    --primary-color: var(--pm-primary);
    --primary-hover: var(--pm-primary-hover);
    --background-color: var(--pm-bg);
    --surface-color: var(--pm-surface);
    --text-color: var(--pm-text);
    --secondary-text-color: var(--pm-text-secondary);
    --border-color: var(--pm-border);
}
/* ============================================================
   2. DARK THEME
   Supports common theme attributes and classes.
   ============================================================ */
html[data-theme="dark"],
body[data-theme="dark"],
html.dark,
body.dark,
html.dark-mode,
body.dark-mode,
[data-theme="dark"] {
    color-scheme: dark;
    --pm-primary: #58b981;
    --pm-primary-hover: #72cd96;
    --pm-primary-soft: #203b2c;
    --pm-primary-border: #355b43;
    --pm-bg: #111713;
    --pm-surface: #19221c;
    --pm-surface-soft: #1d2821;
    --pm-surface-muted: #243129;
    --pm-text: #edf4ee;
    --pm-text-secondary: #b1c0b5;
    --pm-text-muted: #8b9a8f;
    --pm-border: #2c3a30;
    --pm-border-strong: #3b4a3f;
    --pm-success: #72cf98;
    --pm-success-soft: #203b2c;
    --pm-warning: #f1c36b;
    --pm-warning-soft: #40351f;
    --pm-danger: #ff8589;
    --pm-danger-hover: #ffa0a3;
    --pm-danger-soft: #402326;
    --pm-info: #86baff;
    --pm-info-soft: #20334b;
    --pm-shadow-sm:
        0 2px 8px rgba(0, 0, 0, 0.12);
    --pm-shadow-md:
        0 6px 20px rgba(0, 0, 0, 0.16);
    --pm-shadow-lg:
        0 12px 34px rgba(0, 0, 0, 0.24);
    --primary-color: var(--pm-primary);
    --primary-hover: var(--pm-primary-hover);
    --background-color: var(--pm-bg);
    --surface-color: var(--pm-surface);
    --text-color: var(--pm-text);
    --secondary-text-color: var(--pm-text-secondary);
    --border-color: var(--pm-border);
}
/* ============================================================
   3. GLOBAL RESET AND BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    min-height: 100%;
    background: var(--pm-bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--pm-bg);
    color: var(--pm-text);
    font-family: var(--pm-font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition:
        background-color var(--pm-transition),
        color var(--pm-transition);
}
body,
button,
input,
select,
textarea {
    font-family: var(--pm-font);
}
button,
input,
select,
textarea {
    font-size: inherit;
}
button {
    color: inherit;
}
button,
a,
input,
select,
textarea,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}
button,
a {
    touch-action: manipulation;
}

/* Stable touch behavior across Poultry Manager */
html {
    touch-action: manipulation;
}

body,
main,
section,
article,
.pm-view,
.pm-farm-grid,
.pm-farm-card {
    touch-action: manipulation;
}

button,
a {
    touch-action: manipulation;
}

button {
    cursor: pointer;
}
button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}
img,
svg,
canvas {
    max-width: 100%;
}
img {
    height: auto;
}
h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}
h1,
h2,
h3,
h4 {
    color: var(--pm-text);
    line-height: 1.25;
    letter-spacing: -0.025em;
}
p {
    color: var(--pm-text-secondary);
}
a {
    color: var(--pm-primary);
}
[hidden] {
    display: none !important;
}
::selection {
    background: var(--pm-primary-soft);
    color: var(--pm-text);
}
:focus-visible {
    outline: 3px solid var(--pm-primary);
    outline-offset: 3px;
}
/* ============================================================
   4. APPLICATION SHELL
   ============================================================ */
.app {
    width: 100%;
    max-width: 1440px;
    min-height: 100vh;
    margin: 0 auto;
    padding-bottom: 100px;
}
.pm-view {
    width: 100%;
    max-width: var(--pm-content-width);
    margin: 0 auto;
    padding:
        28px
        var(--pm-page-gutter)
        36px;
}
.pm-view[hidden] {
    display: none !important;
}
/* ============================================================
   5. APPLICATION HEADER
   ============================================================ */
.app-header {
    position: relative;
    overflow: hidden;
    background: var(--pm-primary);
    color: #ffffff;
}
.app-header::before {
    position: absolute;
    top: -100px;
    right: -65px;
    width: 280px;
    height: 280px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}
.app-header::after {
    position: absolute;
    right: 90px;
    bottom: -165px;
    width: 260px;
    height: 260px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}
.app-header-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--pm-content-width);
    margin: 0 auto;
    padding: 28px var(--pm-page-gutter) 32px;
}
.app-header-content {
    max-width: 760px;
}
.app-header-eyebrow {
    margin-bottom: 7px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
}
.app-header h1,
#appHeaderTitle {
    margin-bottom: 7px;
    color: #ffffff;
    font-size: clamp(27px, 4vw, 36px);
    font-weight: 800;
    line-height: 1.15;
}
#headerDate {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
}
/* ============================================================
   6. SECTION HEADERS
   ============================================================ */
.section {
    min-width: 0;
    margin-top: 28px;
}
.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 17px;
}
.section-title h2,
.section-title h3 {
    margin-bottom: 5px;
    font-size: 20px;
    font-weight: 800;
}
.section-title p {
    max-width: 620px;
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.6;
}
.subsection {
    margin-top: 26px;
}
.subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.subsection-header h3 {
    margin-bottom: 4px;
    font-size: 16px;
    font-weight: 800;
}
.subsection-header p {
    margin-bottom: 0;
    font-size: 12px;
}
/* ============================================================
   7. FARM OVERVIEW
   Matches .farm-overview-section and related HTML classes.
   ============================================================ */
.farm-overview-section {
    min-width: 0;
}
.farm-overview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.farm-overview-eyebrow,
.pm-view-eyebrow,
.feed-eyebrow {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--pm-primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
}
.farm-overview-header h2 {
    margin-bottom: 7px;
    font-size: clamp(22px, 3vw, 28px);
    font-weight: 800;
}
.farm-overview-header p {
    margin-bottom: 0;
    font-size: 13px;
}
.farm-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}
.farm-overview-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 156px;
    flex-direction: column;
    align-items: flex-start;
    padding: 19px;
    overflow: hidden;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
    transition:
        transform var(--pm-transition),
        box-shadow var(--pm-transition),
        border-color var(--pm-transition);
}
.farm-overview-card-top {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.farm-overview-icon {
    display: inline-flex;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary-soft);
    border-radius: 12px;
    font-size: 19px;
}
.farm-overview-label {
    color: var(--pm-text-secondary);
    font-size: 12px;
    font-weight: 700;
}
.farm-overview-value {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    color: var(--pm-text);
    font-size: clamp(23px, 3vw, 30px);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.2;
}
.farm-overview-description {
    display: block;
    margin-top: 6px;
    color: var(--pm-text-muted);
    font-size: 11px;
}
.farm-overview-card-wide {
    grid-column: span 2;
    min-height: 136px;
}
.farm-overview-card-wide .farm-overview-value {
    font-size: clamp(20px, 3vw, 26px);
}
/* ============================================================
   8. QUICK ACTIONS
   ============================================================ */
.quick-actions {
    margin-top: 25px;
    padding: 22px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.quick-actions-header {
    margin-bottom: 17px;
}
.quick-actions-header h3 {
    margin-bottom: 5px;
    font-size: 17px;
    font-weight: 800;
}
.quick-actions-header p {
    margin-bottom: 0;
    font-size: 12px;
}
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.quick-action-button {
    display: flex;
    min-width: 0;
    min-height: 91px;
    align-items: center;
    gap: 13px;
    padding: 15px;
    text-align: left;
    background: var(--pm-surface-soft);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
    transition:
        background-color var(--pm-transition),
        border-color var(--pm-transition),
        transform var(--pm-transition);
}
.quick-action-button > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}
.quick-action-icon {
    display: inline-flex;
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary-soft);
    border-radius: 13px;
    font-size: 21px;
}
.quick-action-button strong {
    color: var(--pm-text);
    font-size: 13px;
    font-weight: 800;
}
.quick-action-button small {
    color: var(--pm-text-secondary);
    font-size: 11px;
    line-height: 1.45;
}
/* ============================================================
   9. PRODUCTION SUMMARY
   ============================================================ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.summary-card {
    display: flex;
    min-width: 0;
    min-height: 119px;
    flex-direction: column;
    justify-content: space-between;
    gap: 15px;
    padding: 19px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.summary-card > span {
    color: var(--pm-text-secondary);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}
.summary-card > strong {
    color: var(--pm-text);
    font-size: clamp(22px, 2.5vw, 28px);
    font-weight: 800;
    overflow-wrap: anywhere;
}
/* ============================================================
   10. PRODUCTION TREND CHART
   ============================================================ */
.trend-card {
    padding: 22px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.trend-chart-wrapper {
    display: grid;
    min-width: 0;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
    margin-top: 22px;
}
.trend-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 25px;
    color: var(--pm-text-muted);
    font-size: 10px;
    text-align: right;
}
.trend-chart-area {
    position: relative;
    min-width: 0;
    min-height: 190px;
    padding-bottom: 25px;
}
.trend-grid-lines {
    position: absolute;
    inset: 0 0 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}
.trend-grid-lines span {
    display: block;
    width: 100%;
    border-top: 1px dashed var(--pm-border);
}
.production-trend-chart {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 190px;
    align-items: stretch;
    justify-content: space-around;
    gap: 9px;
}
.production-trend-chart > * {
    min-width: 0;
}
.trend-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--pm-text-secondary);
    font-size: 11px;
}
.trend-legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: var(--pm-primary);
    border-radius: 50%;
}
/* ============================================================
   11. ANALYTICS
   ============================================================ */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.analytics-card {
    display: flex;
    min-width: 0;
    min-height: 137px;
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
    padding: 19px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.analytics-label {
    color: var(--pm-text-secondary);
    font-size: 12px;
    font-weight: 600;
}
.analytics-card > strong {
    color: var(--pm-text);
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -0.04em;
    overflow-wrap: anywhere;
}
.analytics-card > small {
    color: var(--pm-text-muted);
    font-size: 11px;
}
.analytics-insight {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 16px;
    padding: 19px;
    background: var(--pm-primary-soft);
    border: 1px solid var(--pm-primary-border);
    border-radius: var(--pm-radius-md);
}
.analytics-insight-icon {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    background: var(--pm-surface);
    border-radius: 12px;
    font-size: 19px;
}
.analytics-insight strong {
    display: block;
    margin-bottom: 5px;
    color: var(--pm-text);
    font-size: 13px;
}
.analytics-insight p {
    margin-bottom: 0;
    font-size: 12px;
    line-height: 1.65;
}
/* ============================================================
   12. SHARED VIEW HEADERS
   ============================================================ */
.pm-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
    padding: 24px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.pm-view-header h2 {
    margin-bottom: 7px;
    font-size: clamp(23px, 3vw, 29px);
    font-weight: 800;
}
.pm-view-header p {
    max-width: 580px;
    margin-bottom: 0;
    font-size: 13px;
}
/* ============================================================
   13. MY FARM SNAPSHOT
   ============================================================ */
.pm-farm-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.pm-farm-card {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 13px;
    padding: 19px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.pm-farm-card > span {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary-soft);
    border-radius: 13px;
    font-size: 20px;
}
.pm-farm-card > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}
.pm-farm-card small {
    color: var(--pm-text-secondary);
    font-size: 11px;
    font-weight: 600;
}
.pm-farm-card strong {
    color: var(--pm-text);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.pm-farm-card em {
    color: var(--pm-text-muted);
    font-size: 11px;
    font-style: normal;
}
/* ============================================================
   14. FARM MANAGEMENT
   ============================================================ */
.pm-farm-section {
    min-width: 0;
    padding: 23px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.pm-farm-management-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
    background: var(--pm-surface-soft);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
}
.pm-farm-management-card > div:first-child {
    display: flex;
    align-items: center;
    gap: 14px;
}
.pm-farm-management-icon {
    display: inline-flex;
    width: 45px;
    height: 45px;
    flex: 0 0 45px;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary-soft);
    border-radius: 13px;
    font-size: 21px;
}
.pm-farm-management-card > div:first-child > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.pm-farm-management-card strong {
    color: var(--pm-text);
    font-size: 14px;
    font-weight: 800;
}
.pm-farm-management-card small {
    color: var(--pm-text-secondary);
    font-size: 12px;
}
.pm-farm-flock-control {
    display: flex;
    align-items: center;
    gap: 14px;
}
.pm-farm-flock-control > strong {
    min-width: 40px;
    color: var(--pm-text);
    font-size: 23px;
    text-align: center;
}
/* ============================================================
   15. BUTTON SYSTEM
   ============================================================ */
.primary-button,
.secondary-button,
.text-button,
.feed-reset-button {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    transition:
        background-color var(--pm-transition),
        border-color var(--pm-transition),
        color var(--pm-transition),
        box-shadow var(--pm-transition),
        transform var(--pm-transition);
}
.primary-button {
    background: var(--pm-primary);
    border-color: var(--pm-primary);
    color: #ffffff;
}
.secondary-button {
    background: var(--pm-surface);
    border-color: var(--pm-border-strong);
    color: var(--pm-text);
}
.text-button {
    min-height: 36px;
    padding: 7px 10px;
    background: transparent;
    color: var(--pm-primary);
}
.feed-reset-button {
    min-height: 36px;
    margin-top: 11px;
    padding: 8px 11px;
    background: var(--pm-danger-soft);
    border-color: transparent;
    color: var(--pm-danger);
    font-size: 11px;
}
.primary-button:active,
.secondary-button:active,
.text-button:active,
.feed-reset-button:active,
.quick-action-button:active {
    transform: scale(0.98);
}
/* ============================================================
   16. EGG PRODUCTION
   ============================================================ */
.egg-main-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--pm-primary-soft);
    border: 1px solid var(--pm-primary-border);
    border-radius: var(--pm-radius-lg);
}
.egg-number,
.laying-rate {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.egg-number > span {
    color: var(--pm-text);
    font-size: clamp(40px, 7vw, 56px);
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 1.1;
}
.laying-rate > span {
    color: var(--pm-primary);
    font-size: clamp(29px, 5vw, 40px);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.2;
}
.egg-number > small,
.laying-rate > small {
    color: var(--pm-text-secondary);
    font-size: 12px;
    font-weight: 600;
}
.egg-actions {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 11px;
    padding-top: 17px;
    border-top: 1px solid var(--pm-primary-border);
}
.egg-actions button {
    flex: 1 1 160px;
}
/* ============================================================
   17. EGG HISTORY
   ============================================================ */
.history-list,
.feed-history-list {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 10px;
}
.history-list:empty,
.feed-history-list:empty {
    min-height: 50px;
}
.history-list > *,
.feed-history-list > * {
    min-width: 0;
    overflow-wrap: anywhere;
}
/* ============================================================
   18. FEED MANAGEMENT DASHBOARD
   ============================================================ */
.feed-management-section {
    scroll-margin-top: 20px;
}
.feed-dashboard {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.feed-hero-card {
    display: flex;
    min-width: 0;
    min-height: 205px;
    grid-column: 1 / -1;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    padding: 24px;
    overflow: hidden;
    background: var(--pm-primary);
    border: 1px solid var(--pm-primary);
    border-radius: var(--pm-radius-lg);
    color: #ffffff;
}
.feed-hero-card,
.feed-hero-card * {
    color: #ffffff;
}
.feed-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.feed-hero-top > div:first-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}
.feed-hero-card .feed-eyebrow {
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.75);
}
.feed-hero-card #feedAmount {
    font-size: clamp(32px, 5vw, 43px);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.feed-hero-card small {
    color: rgba(255, 255, 255, 0.78);
    font-size: 11px;
}
.feed-status-badge {
    display: inline-flex;
    max-width: 180px;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}
.feed-status-badge.feed-status-neutral,
.feed-status-badge.feed-status-good,
.feed-status-badge.feed-status-warning,
.feed-status-badge.feed-status-low,
.feed-status-badge.feed-status-critical {
    color: #ffffff;
}
.feed-stock-progress {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.feed-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 11px;
}
.feed-progress-track {
    width: 100%;
    height: 9px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
}
.feed-progress-fill {
    width: 0;
    height: 100%;
    min-width: 0;
    background: #ffffff;
    border-radius: inherit;
    transition: width 300ms ease;
}
.feed-metric-card {
    display: flex;
    min-width: 0;
    min-height: 135px;
    flex-direction: column;
    align-items: flex-start;
    gap: 11px;
    padding: 19px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.feed-metric-label {
    color: var(--pm-text-secondary);
    font-size: 12px;
    font-weight: 700;
}
.feed-metric-card > strong {
    color: var(--pm-text);
    font-size: clamp(23px, 3vw, 29px);
    font-weight: 800;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}
.feed-metric-card > small {
    color: var(--pm-text-muted);
    font-size: 11px;
    line-height: 1.5;
}
/* ============================================================
   19. FEED INVENTORY ACTIONS
   ============================================================ */
.feed-action-panel {
    margin-top: 20px;
    padding: 23px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.feed-action-header,
.feed-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.feed-action-header h3,
.feed-card-header h3 {
    margin-bottom: 5px;
    font-size: 17px;
    font-weight: 800;
}
.feed-action-header p,
.feed-card-header p {
    margin-bottom: 0;
    font-size: 12px;
    line-height: 1.6;
}
.feed-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}
.feed-action-box {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 14px;
    padding: 19px;
    background: var(--pm-surface-soft);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
}
.feed-action-icon {
    display: inline-flex;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    align-items: center;
    justify-content: center;
    background: var(--pm-success-soft);
    border-radius: 12px;
    color: var(--pm-success);
    font-size: 25px;
    font-weight: 700;
}
.feed-action-icon.feed-use-icon {
    background: var(--pm-warning-soft);
    color: var(--pm-warning);
}
.feed-action-content {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
}
.feed-action-content > strong {
    margin-bottom: 5px;
    color: var(--pm-text);
    font-size: 14px;
    font-weight: 800;
}
.feed-action-content > span {
    margin-bottom: 15px;
    color: var(--pm-text-secondary);
    font-size: 11px;
    line-height: 1.55;
}
.feed-input-row {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: stretch;
    gap: 8px;
}
.feed-input-row input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    flex: 1 1 100px;
    padding: 10px 12px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border-strong);
    border-radius: 10px;
    color: var(--pm-text);
    outline: none;
}
.feed-input-row input:focus {
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px var(--pm-primary-soft);
}
.feed-input-row button {
    flex: 0 0 auto;
    white-space: nowrap;
}
/* ============================================================
   20. FEED CONSUMPTION
   ============================================================ */
.feed-consumption-card {
    margin-top: 20px;
    padding: 23px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
.feed-period-label {
    flex: 0 0 auto;
    padding: 7px 10px;
    background: var(--pm-primary-soft);
    border-radius: 9px;
    color: var(--pm-primary);
    font-size: 10px;
    font-weight: 800;
}
.feed-consumption-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.feed-consumption-summary > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 7px;
    padding: 14px;
    background: var(--pm-surface-soft);
    border: 1px solid var(--pm-border);
    border-radius: 12px;
}
.feed-consumption-summary span {
    color: var(--pm-text-secondary);
    font-size: 11px;
}
.feed-consumption-summary strong {
    color: var(--pm-text);
    font-size: clamp(17px, 2.5vw, 23px);
    font-weight: 800;
    overflow-wrap: anywhere;
}
.feed-chart-wrapper {
    min-width: 0;
    margin-top: 22px;
    padding: 14px 0 0;
    overflow-x: auto;
}
.feed-consumption-chart {
    display: flex;
    min-width: 0;
    min-height: 160px;
    align-items: stretch;
    justify-content: space-around;
    gap: 9px;
}
.feed-consumption-chart > * {
    min-width: 0;
}
/* ============================================================
   21. PROFILE VIEW
   ============================================================ */
.pm-profile-header {
    align-items: center;
}
.pm-profile-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 17px;
}
.pm-profile-avatar {
    display: inline-flex;
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary-soft);
    border: 1px solid var(--pm-primary-border);
    border-radius: 22px;
    color: var(--pm-primary);
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.04em;
}
.pm-profile-heading h2 {
    overflow-wrap: anywhere;
}
.pm-profile-heading p {
    overflow-wrap: anywhere;
}
.pm-profile-card {
    padding: 24px;
}
.pm-profile-card-header {
    margin-bottom: 22px;
    padding-bottom: 17px;
    border-bottom: 1px solid var(--pm-border);
}
.pm-profile-card-header h2 {
    margin-bottom: 5px;
    font-size: 19px;
    font-weight: 800;
}
.pm-profile-card-header p {
    margin-bottom: 0;
    font-size: 12px;
}
.pm-profile-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 22px;
}
.pm-profile-info-item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    padding: 16px 0;
    border-bottom: 1px solid var(--pm-border);
}
.pm-profile-info-item > span,
.pm-profile-notes > span {
    color: var(--pm-text-secondary);
    font-size: 11px;
    font-weight: 600;
}
.pm-profile-info-item > strong {
    color: var(--pm-text);
    font-size: 13px;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.pm-profile-notes {
    margin-top: 20px;
    padding: 17px;
    background: var(--pm-surface-soft);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
}
.pm-profile-notes p {
    margin: 7px 0 0;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.pm-profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.pm-profile-stat {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    padding: 17px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
}
.pm-profile-stat > span {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    background: var(--pm-primary-soft);
    border-radius: 12px;
    font-size: 19px;
}
.pm-profile-stat > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}
.pm-profile-stat small {
    color: var(--pm-text-secondary);
    font-size: 10px;
    line-height: 1.4;
}
.pm-profile-stat strong {
    color: var(--pm-text);
    font-size: 20px;
    font-weight: 800;
    overflow-wrap: anywhere;
}
/* ============================================================
   22. PROFILE EDIT FORM
   ============================================================ */
.pm-profile-edit-form {
    width: 100%;
}
.pm-profile-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 19px;
}
.pm-profile-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
}
.pm-profile-field-full {
    grid-column: 1 / -1;
}
.pm-profile-field label {
    color: var(--pm-text);
    font-size: 12px;
    font-weight: 700;
}
.pm-profile-field input,
.pm-profile-field select,
.pm-profile-field textarea {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 11px 13px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border-strong);
    border-radius: 11px;
    color: var(--pm-text);
    font-size: 13px;
    outline: none;
    transition:
        border-color var(--pm-transition),
        box-shadow var(--pm-transition);
}
.pm-profile-field textarea {
    min-height: 110px;
    resize: vertical;
}
.pm-profile-field input::placeholder,
.pm-profile-field textarea::placeholder {
    color: var(--pm-text-muted);
    opacity: 1;
}
.pm-profile-field input:focus,
.pm-profile-field select:focus,
.pm-profile-field textarea:focus {
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px var(--pm-primary-soft);
}
.pm-profile-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--pm-border);
}
/* ============================================================
   23. MAIN APPLICATION NAVIGATION
   ============================================================ */
.app-navigation {
    position: fixed;
    z-index: 1000;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    width: 100%;
    max-width: 1440px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin: 0 auto;
    padding:
        10px
        max(14px, env(safe-area-inset-right))
        calc(10px + env(safe-area-inset-bottom))
        max(14px, env(safe-area-inset-left));
    background: var(--pm-surface);
    border-top: 1px solid var(--pm-border);
    box-shadow: 0 -5px 20px rgba(25, 45, 30, 0.045);
}
.app-navigation button {
    display: flex;
    min-width: 0;
    min-height: 60px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 13px;
    color: var(--pm-text-muted);
    transition:
        background-color var(--pm-transition),
        color var(--pm-transition);
}
.app-navigation button.active,
.app-navigation button[aria-current="page"] {
    background: var(--pm-primary-soft);
    color: var(--pm-primary);
}
.nav-icon {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}
.nav-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* ============================================================
   24. GENERIC SETTINGS CONTENT
   Supports settings controls inserted by main.js.
   ============================================================ */
.pm-settings-view .section,
.pm-settings-view section {
    min-width: 0;
    margin-bottom: 20px;
}
.pm-settings-view h2 {
    font-size: 20px;
    font-weight: 800;
}
.pm-settings-view h3 {
    font-size: 16px;
    font-weight: 800;
}
.pm-settings-view p {
    font-size: 13px;
    line-height: 1.65;
}
.pm-settings-view label {
    color: var(--pm-text);
    font-size: 12px;
    font-weight: 600;
}
.pm-settings-view input:not([type="checkbox"]):not([type="radio"]),
.pm-settings-view select,
.pm-settings-view textarea {
    max-width: 100%;
    min-height: 43px;
    padding: 10px 12px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border-strong);
    border-radius: 10px;
    color: var(--pm-text);
}
.pm-settings-view input[type="checkbox"],
.pm-settings-view input[type="radio"] {
    accent-color: var(--pm-primary);
}
.pm-settings-view button {
    touch-action: manipulation;
}
.pm-settings-view .card,
.pm-settings-view .settings-card,
.pm-settings-view .setting-card {
    min-width: 0;
    padding: 20px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
}
/* ============================================================
   25. FEED EXTRA ACTIONS
   Styles controls created by JavaScript where applicable.
   ============================================================ */
.pm-feed-extra-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 12px;
}
.pm-feed-extra-actions button {
    max-width: 100%;
}
/* ============================================================
   26. GENERAL STATUS, BADGES AND MESSAGES
   ============================================================ */
.badge,
.status-badge,
.pm-badge {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.success,
.badge-success,
.status-success {
    background: var(--pm-success-soft);
    color: var(--pm-success);
}
.warning,
.badge-warning,
.status-warning {
    background: var(--pm-warning-soft);
    color: var(--pm-warning);
}
.danger,
.badge-danger,
.status-danger {
    background: var(--pm-danger-soft);
    color: var(--pm-danger);
}
.info,
.badge-info,
.status-info {
    background: var(--pm-info-soft);
    color: var(--pm-info);
}
.empty-state {
    padding: 24px 16px;
    color: var(--pm-text-muted);
    font-size: 12px;
    text-align: center;
}
.alert,
.pm-alert {
    padding: 13px 15px;
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.6;
}
.alert-success {
    background: var(--pm-success-soft);
    color: var(--pm-success);
}
.alert-warning {
    background: var(--pm-warning-soft);
    color: var(--pm-warning);
}
.alert-danger {
    background: var(--pm-danger-soft);
    color: var(--pm-danger);
}
/* ============================================================
   27. DYNAMIC CONTENT AND TABLES
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
}
th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--pm-border);
    text-align: left;
    vertical-align: middle;
}
th {
    background: var(--pm-surface-soft);
    color: var(--pm-text-secondary);
    font-size: 11px;
    font-weight: 800;
}
td {
    color: var(--pm-text);
    font-size: 12px;
}
tr:last-child td {
    border-bottom: 0;
}
.history-list table,
.feed-history-list table,
.pm-settings-view table {
    min-width: 460px;
}
.history-list,
.feed-history-list {
    overflow-wrap: anywhere;
}
/* ============================================================
   28. SCROLLBARS
   ============================================================ */
* {
    scrollbar-width: thin;
    scrollbar-color:
        var(--pm-border-strong)
        transparent;
}
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--pm-border-strong);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}
/* ============================================================
   29. HOVER STATES
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
    .farm-overview-card:hover,
    .summary-card:hover,
    .analytics-card:hover,
    .pm-farm-card:hover,
    .pm-profile-stat:hover,
    .feed-metric-card:hover {
        border-color: var(--pm-primary-border);
        box-shadow: var(--pm-shadow-md);
        transform: translateY(-2px);
    }
    .quick-action-button:hover {
        background: var(--pm-primary-soft);
        border-color: var(--pm-primary-border);
        transform: translateY(-2px);
    }
    .primary-button:hover {
        background: var(--pm-primary-hover);
        border-color: var(--pm-primary-hover);
    }
    .secondary-button:hover {
        background: var(--pm-surface-muted);
        border-color: var(--pm-border-strong);
    }
    .text-button:hover {
        background: var(--pm-primary-soft);
    }
    .feed-reset-button:hover {
        filter: brightness(0.97);
    }
    .app-navigation button:hover {
        background: var(--pm-surface-muted);
        color: var(--pm-primary);
    }
}
/* ============================================================
   30. TABLET RESPONSIVENESS
   ============================================================ */
@media (max-width: 900px) {
    :root {
        --pm-page-gutter: 20px;
    }
    .farm-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .analytics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pm-farm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pm-profile-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .feed-dashboard {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .feed-hero-card {
        grid-column: 1 / -1;
    }
    .feed-metric-card:last-child {
        grid-column: 1 / -1;
    }
    .feed-action-grid {
        grid-template-columns: 1fr;
    }
}
/* ============================================================
   31. MOBILE RESPONSIVENESS
   ============================================================ */
@media (max-width: 600px) {
    :root {
        --pm-page-gutter: 15px;
    }
    body {
        font-size: 14px;
    }
    .app {
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }
    .app-header-inner {
        padding-top: 23px;
        padding-bottom: 25px;
    }
    .app-header-eyebrow {
        font-size: 10px;
    }
    #appHeaderTitle {
        font-size: 28px;
    }
    #headerDate {
        font-size: 12px;
    }
    .pm-view {
        padding-top: 22px;
        padding-bottom: 27px;
    }
    .section {
        margin-top: 23px;
    }
    .section-title {
        gap: 10px;
        margin-bottom: 14px;
    }
    .section-title h2,
    .section-title h3 {
        font-size: 18px;
    }
    .farm-overview-header {
        margin-bottom: 16px;
    }
    .farm-overview-header h2 {
        font-size: 23px;
    }
    .farm-overview-grid {
        gap: 10px;
    }
    .farm-overview-card {
        min-height: 140px;
        padding: 14px;
        border-radius: 15px;
    }
    .farm-overview-card-top {
        gap: 8px;
        margin-bottom: 15px;
    }
    .farm-overview-icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
        font-size: 17px;
    }
    .farm-overview-label {
        font-size: 11px;
    }
    .farm-overview-value {
        font-size: 25px;
    }
    .farm-overview-description {
        font-size: 10px;
    }
    .farm-overview-card-wide {
        min-height: 125px;
    }
    .farm-overview-card-wide .farm-overview-value {
        font-size: 20px;
    }
    .quick-actions {
        margin-top: 19px;
        padding: 16px;
        border-radius: 16px;
    }
    .quick-actions-grid {
        grid-template-columns: 1fr;
        gap: 9px;
    }
    .quick-action-button {
        min-height: 72px;
        padding: 12px;
    }
    .quick-action-icon {
        width: 39px;
        height: 39px;
        flex-basis: 39px;
        font-size: 19px;
    }
    .summary-grid,
    .analytics-grid {
        gap: 10px;
    }
    .summary-card {
        min-height: 105px;
        padding: 14px;
        border-radius: 15px;
    }
    .summary-card > span {
        font-size: 11px;
    }
    .summary-card > strong {
        font-size: 23px;
    }
    .trend-card {
        padding: 16px;
    }
    .trend-chart-wrapper {
        grid-template-columns: 25px minmax(0, 1fr);
        gap: 8px;
    }
    .trend-chart-area,
    .production-trend-chart {
        min-height: 160px;
    }
    .analytics-card {
        min-height: 120px;
        gap: 8px;
        padding: 14px;
        border-radius: 15px;
    }
    .analytics-label {
        font-size: 11px;
    }
    .analytics-card > strong {
        font-size: 24px;
    }
    .analytics-card > small {
        font-size: 10px;
    }
    .analytics-insight {
        gap: 11px;
        padding: 14px;
    }
    .pm-view-header {
        align-items: flex-start;
        padding: 19px;
        border-radius: 16px;
    }
    .pm-view-header h2 {
        font-size: 24px;
    }
    .pm-view-header p {
        font-size: 12px;
    }
    .pm-farm-grid {
        gap: 10px;
        margin-bottom: 20px;
    }
    .pm-farm-card {
        gap: 10px;
        padding: 13px;
        border-radius: 15px;
    }
    .pm-farm-card > span {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
        font-size: 17px;
    }
    .pm-farm-card strong {
        font-size: 22px;
    }
    .pm-farm-section {
        padding: 16px;
        border-radius: 16px;
    }
    .pm-farm-management-card {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
        padding: 15px;
    }
    .pm-farm-flock-control {
        width: 100%;
        justify-content: flex-end;
    }
    .egg-main-card {
        gap: 18px 12px;
        padding: 18px;
        border-radius: 16px;
    }
    .egg-number > span {
        font-size: 43px;
    }
    .laying-rate > span {
        font-size: 32px;
    }
    .egg-actions {
        gap: 9px;
    }
    .egg-actions button {
        flex-basis: 100%;
        width: 100%;
    }
    .subsection-header {
        align-items: flex-start;
    }
    .subsection-header h3 {
        font-size: 15px;
    }
    .subsection-header p {
        font-size: 11px;
    }
    .subsection-header .text-button {
        padding-right: 0;
        padding-left: 0;
        font-size: 10px;
    }
    .feed-dashboard {
        gap: 10px;
    }
    .feed-hero-card {
        min-height: 190px;
        padding: 19px;
        border-radius: 16px;
    }
    .feed-hero-card #feedAmount {
        font-size: 34px;
    }
    .feed-status-badge {
        max-width: 130px;
        padding: 6px 8px;
        font-size: 9px;
    }
    .feed-metric-card {
        min-height: 120px;
        gap: 9px;
        padding: 13px;
        border-radius: 15px;
    }
    .feed-metric-label {
        font-size: 10px;
    }
    .feed-metric-card > strong {
        font-size: 22px;
    }
    .feed-metric-card > small {
        font-size: 10px;
    }
    .feed-action-panel,
    .feed-consumption-card {
        padding: 16px;
        border-radius: 16px;
    }
    .feed-action-box {
        gap: 11px;
        padding: 13px;
    }
    .feed-action-icon {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        font-size: 22px;
    }
    .feed-input-row {
        flex-direction: column;
        align-items: stretch;
    }
    .feed-input-row input,
    .feed-input-row button {
        width: 100%;
        min-height: 44px;
    }
    .feed-consumption-summary {
        gap: 8px;
    }
    .feed-consumption-summary > div {
        gap: 6px;
        padding: 10px;
    }
    .feed-consumption-summary span {
        font-size: 10px;
        line-height: 1.4;
    }
    .feed-consumption-summary strong {
        font-size: 17px;
    }
    .pm-profile-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .pm-profile-header > .primary-button {
        width: 100%;
    }
    .pm-profile-heading {
        gap: 12px;
    }
    .pm-profile-avatar {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
        border-radius: 17px;
        font-size: 19px;
    }
    .pm-profile-heading h2 {
        font-size: 22px;
    }
    .pm-profile-card {
        padding: 17px;
    }
    .pm-profile-info-grid {
        grid-template-columns: 1fr;
    }
    .pm-profile-info-item {
        padding: 13px 0;
    }
    .pm-profile-stats {
        gap: 10px;
    }
    .pm-profile-stat {
        gap: 9px;
        padding: 12px;
    }
    .pm-profile-stat > span {
        width: 33px;
        height: 33px;
        flex-basis: 33px;
        border-radius: 10px;
        font-size: 16px;
    }
    .pm-profile-stat small {
        font-size: 9px;
    }
    .pm-profile-stat strong {
        font-size: 18px;
    }
    .pm-profile-edit-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .pm-profile-field-full {
        grid-column: auto;
    }
    .pm-profile-actions {
        flex-direction: column-reverse;
    }
    .pm-profile-actions button {
        width: 100%;
    }
    .app-navigation {
        gap: 3px;
        padding-top: 7px;
        padding-bottom: calc(7px + env(safe-area-inset-bottom));
    }
    .app-navigation button {
        min-height: 57px;
        gap: 4px;
        border-radius: 11px;
    }
    .nav-icon {
        font-size: 21px;
    }
    .nav-label {
        font-size: 10px;
    }
}
/* ============================================================
   32. VERY SMALL PHONES
   ============================================================ */
@media (max-width: 360px) {
    :root {
        --pm-page-gutter: 11px;
    }
    .farm-overview-card {
        padding: 11px;
    }
    .farm-overview-icon {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
        font-size: 15px;
    }
    .farm-overview-label {
        font-size: 10px;
    }
    .farm-overview-value {
        font-size: 22px;
    }
    .summary-card {
        padding: 12px;
    }
    .summary-card > strong {
        font-size: 21px;
    }
    .pm-farm-card {
        padding: 10px;
    }
    .pm-farm-card > span {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
    .pm-profile-stat {
        align-items: flex-start;
        flex-direction: column;
    }
    .feed-hero-top {
        flex-direction: column;
    }
    .feed-status-badge {
        max-width: 100%;
    }
    .feed-consumption-summary {
        grid-template-columns: 1fr;
    }
    .feed-consumption-summary > div {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    .feed-consumption-summary strong {
        text-align: right;
    }
}
/* ============================================================
   33. REDUCED MOTION ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/* ============================================================
   34. FINAL LAYOUT SAFEGUARDS
   ============================================================ */
#pmDashboardView,
#pmFarmView,
#pmProfileView,
#pmSettingsView {
    min-width: 0;
}
#pmDashboardView > *,
#pmFarmView > *,
#pmProfileView > *,
#pmSettingsView > * {
    min-width: 0;
}
input,
select,
textarea,
button {
    max-width: 100%;
}
button {
    user-select: none;
    -webkit-user-select: none;
}
input,
select,
textarea {
    user-select: text;
    -webkit-user-select: text;
}
@media (max-width: 600px) {
    .app-header,
    .app-navigation {
        width: 100%;
    }
    .pm-view {
        overflow-wrap: break-word;
    }
}

/* ============================================================
   POULTRY MANAGER — TARGETED UI CORRECTIONS
   Fixes:
   1. Egg History cards and View All History button
   2. Recent Feed Activity cards
   3. Dynamically generated Settings interface

   Append this section to the END of style.css.
   ============================================================ */


/* ============================================================
   1. EGG HISTORY
   ============================================================ */

#eggHistoryList,
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    margin-top: 12px;
}

.history-list .history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 16px 18px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
    box-shadow: var(--pm-shadow-sm);
    transition:
        border-color var(--pm-transition),
        box-shadow var(--pm-transition),
        background-color var(--pm-transition);
}

.history-item > div:first-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.history-item > div:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    text-align: right;
}

.history-item strong {
    color: var(--pm-text);
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.history-item span {
    color: var(--pm-text-secondary);
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Egg History heading and View All History button */

.subsection-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.subsection-header > div,
.subsection-header > div:first-child {
    min-width: 0;
}

#viewHistoryButton,
#viewFeedHistoryButton {
    display: inline-flex;
    min-height: 38px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: var(--pm-primary-soft);
    border: 1px solid var(--pm-primary-border);
    border-radius: 10px;
    color: var(--pm-primary);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background-color var(--pm-transition),
        border-color var(--pm-transition),
        transform var(--pm-transition);
}

#viewHistoryButton:active,
#viewFeedHistoryButton:active {
    transform: scale(0.97);
}


/* ============================================================
   2. RECENT FEED ACTIVITIES
   ============================================================ */

#feedHistoryList,
.feed-history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    margin-top: 12px;
}

.feed-history-list .feed-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 16px 18px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-md);
    box-shadow: var(--pm-shadow-sm);
    transition:
        border-color var(--pm-transition),
        box-shadow var(--pm-transition),
        background-color var(--pm-transition);
}

.feed-history-item > div,
.feed-history-item > div:first-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
}

.feed-history-item strong {
    color: var(--pm-text);
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.feed-history-item span {
    color: var(--pm-text-secondary);
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Keep activity amounts readable without breaking mobile layout */

.feed-history-item > strong {
    flex: 0 0 auto;
    text-align: right;
    white-space: normal;
}

/* Consistent spacing for the Recent Feed Activity section */

.feed-activity-section {
    min-width: 0;
    margin-top: 26px;
}

.feed-activity-section .subsection-header {
    margin-bottom: 14px;
}


/* ============================================================
   3. SETTINGS — MAIN LAYOUT
   These selectors match the classes generated by main.js.
   ============================================================ */

#pmSettingsView {
    min-width: 0;
}

#pmSettingsView .pm-settings-shell {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 26px;
}

#pmSettingsView .pm-section {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
}

#pmSettingsView .pm-section-heading {
    margin-bottom: 2px;
}

#pmSettingsView .pm-eyebrow {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--pm-primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#pmSettingsView .pm-section-heading h2,
#pmSettingsView .pm-section-heading h3 {
    margin-bottom: 7px;
    color: var(--pm-text);
    font-weight: 800;
}

#pmSettingsView .pm-section-heading p {
    margin-bottom: 0;
    color: var(--pm-text-secondary);
    font-size: 13px;
    line-height: 1.65;
}


/* ============================================================
   4. SETTINGS — CARDS
   IMPORTANT: The actual class is .pm-settings-card.
   ============================================================ */

#pmSettingsView .pm-settings-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 17px;
    padding: 22px;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-lg);
    box-shadow: var(--pm-shadow-sm);
    transition:
        border-color var(--pm-transition),
        box-shadow var(--pm-transition),
        background-color var(--pm-transition);
}

#pmSettingsView .pm-settings-card h3,
#pmSettingsView .pm-settings-card h4 {
    margin-bottom: 5px;
    color: var(--pm-text);
    font-weight: 800;
}

#pmSettingsView .pm-settings-card p {
    color: var(--pm-text-secondary);
    font-size: 12px;
    line-height: 1.65;
}

#pmSettingsView .pm-settings-card > :last-child {
    margin-bottom: 0;
}


/* ============================================================
   5. SETTINGS — SETTING ROWS
   ============================================================ */

#pmSettingsView .pm-setting-row {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 0;
    border-bottom: 1px solid var(--pm-border);
}

#pmSettingsView .pm-setting-row:first-child {
    padding-top: 0;
}

#pmSettingsView .pm-setting-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

#pmSettingsView .pm-setting-row > div:first-child {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 5px;
}

#pmSettingsView .pm-setting-row strong,
#pmSettingsView .pm-setting-row h4 {
    margin-bottom: 0;
    color: var(--pm-text);
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

#pmSettingsView .pm-setting-row small,
#pmSettingsView .pm-setting-row p {
    margin-bottom: 0;
    color: var(--pm-text-secondary);
    font-size: 11px;
    line-height: 1.6;
}


/* ============================================================
   6. SETTINGS — FORM CONTROLS
   ============================================================ */

#pmSettingsView input:not([type="checkbox"]):not([type="radio"]),
#pmSettingsView select,
#pmSettingsView textarea {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 44px;
    padding: 11px 13px;
    background: var(--pm-surface-soft);
    border: 1px solid var(--pm-border-strong);
    border-radius: 11px;
    color: var(--pm-text);
    font-family: var(--pm-font);
    font-size: 13px;
    outline: none;
    transition:
        border-color var(--pm-transition),
        box-shadow var(--pm-transition),
        background-color var(--pm-transition);
}

#pmSettingsView textarea {
    min-height: 100px;
    resize: vertical;
}

#pmSettingsView input::placeholder,
#pmSettingsView textarea::placeholder {
    color: var(--pm-text-muted);
    opacity: 1;
}

#pmSettingsView input:focus,
#pmSettingsView select:focus,
#pmSettingsView textarea:focus {
    background: var(--pm-surface);
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px var(--pm-primary-soft);
}

#pmSettingsView input[type="checkbox"],
#pmSettingsView input[type="radio"] {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--pm-primary);
    cursor: pointer;
}


/* ============================================================
   7. SETTINGS — TOGGLE ROWS
   ============================================================ */

#pmSettingsView .pm-setting-toggle {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#pmSettingsView .pm-setting-toggle > label {
    min-width: 0;
    flex: 1 1 auto;
    color: var(--pm-text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
    cursor: pointer;
}

#pmSettingsView .pm-setting-toggle input[type="checkbox"] {
    margin: 0;
}


/* ============================================================
   8. SETTINGS — BUTTONS
   The generated buttons use pm-primary-button and
   pm-secondary-button, not just primary-button.
   ============================================================ */

#pmSettingsView .pm-primary-button,
#pmSettingsView .pm-secondary-button {
    display: inline-flex;
    min-height: 43px;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-family: var(--pm-font);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition:
        background-color var(--pm-transition),
        border-color var(--pm-transition),
        color var(--pm-transition),
        transform var(--pm-transition);
}

#pmSettingsView .pm-primary-button {
    background: var(--pm-primary);
    border-color: var(--pm-primary);
    color: #ffffff;
}

#pmSettingsView .pm-secondary-button {
    background: var(--pm-surface);
    border-color: var(--pm-border-strong);
    color: var(--pm-text);
}

#pmSettingsView .pm-primary-button:active,
#pmSettingsView .pm-secondary-button:active {
    transform: scale(0.98);
}

#pmSettingsView .pm-settings-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}


/* ============================================================
   9. SETTINGS — STATUS MESSAGES
   ============================================================ */

#pmSettingsView [id$="Status"] {
    display: block;
    color: var(--pm-text-secondary);
    font-size: 11px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

#pmSettingsView .pm-settings-card [role="status"],
#pmSettingsView .pm-settings-card [aria-live] {
    color: var(--pm-text-secondary);
    font-size: 11px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}


/* ============================================================
   10. SETTINGS — ABOUT CARD
   ============================================================ */

#pmSettingsView .pm-about-card {
    min-width: 0;
    padding: 22px;
    background: var(--pm-primary-soft);
    border: 1px solid var(--pm-primary-border);
    border-radius: var(--pm-radius-lg);
}

#pmSettingsView .pm-about-card h3,
#pmSettingsView .pm-about-card h4 {
    color: var(--pm-text);
    font-weight: 800;
}

#pmSettingsView .pm-about-card p,
#pmSettingsView .pm-about-card small {
    color: var(--pm-text-secondary);
    line-height: 1.7;
    overflow-wrap: anywhere;
}


/* ============================================================
   11. DARK THEME COMPATIBILITY
   ============================================================ */

html[data-theme="dark"] #eggHistoryList .history-item,
html[data-theme="dark"] #feedHistoryList .feed-history-item,
html[data-theme="dark"] #pmSettingsView .pm-settings-card,
body[data-theme="dark"] #eggHistoryList .history-item,
body[data-theme="dark"] #feedHistoryList .feed-history-item,
body[data-theme="dark"] #pmSettingsView .pm-settings-card {
    background: var(--pm-surface);
    border-color: var(--pm-border);
}

html[data-theme="dark"] #pmSettingsView .pm-about-card,
body[data-theme="dark"] #pmSettingsView .pm-about-card {
    background: var(--pm-primary-soft);
    border-color: var(--pm-primary-border);
}


/* ============================================================
   12. MOBILE LAYOUT CORRECTIONS
   ============================================================ */

@media (max-width: 600px) {
    #eggHistoryList .history-item,
    #feedHistoryList .feed-history-item {
        gap: 12px;
        padding: 14px;
        border-radius: 13px;
    }

    .history-item strong,
    .feed-history-item strong {
        font-size: 12px;
    }

    .history-item span,
    .feed-history-item span {
        font-size: 10px;
    }

    #viewHistoryButton,
    #viewFeedHistoryButton {
        min-height: 35px;
        padding: 7px 9px;
        font-size: 10px;
    }

    #pmSettingsView .pm-settings-shell {
        gap: 21px;
    }

    #pmSettingsView .pm-section {
        gap: 11px;
    }

    #pmSettingsView .pm-settings-card,
    #pmSettingsView .pm-about-card {
        padding: 16px;
        border-radius: 15px;
    }

    #pmSettingsView .pm-setting-row {
        align-items: flex-start;
        gap: 12px;
        padding: 14px 0;
    }

    #pmSettingsView .pm-setting-toggle {
        align-items: flex-start;
    }

    #pmSettingsView .pm-settings-actions {
        align-items: stretch;
        flex-direction: column;
    }

    #pmSettingsView .pm-settings-actions button {
        width: 100%;
    }
}


/* ============================================================
   END OF TARGETED UI CORRECTIONS
   ============================================================ */


/* =====================================================
   PREVENT ACCIDENTAL DOUBLE-TAP ZOOM
   POULTRY MANAGER
   ===================================================== */

button,
a,
.pm-card,
.history-item,
.feed-history-item,
.pm-bottom-nav,
.pm-bottom-nav *,
input,
select,
textarea {
    touch-action: manipulation;
}

