/* Dashboard-specific styles – Farm Manager brand palette */

:root {
    --fm-green-dark: #234f2e;
    --fm-green: #2f6b2f;
    --fm-text: #1f2520;
    --fm-muted: #566052;
    --fm-page-bg: #eef1e6;
    --fm-green-soft: #e6efe2;
    --fm-surface: #ffffff;
    --fm-surface-soft: #f8f9f4;
    --fm-border: #cfd8c6;
    --fm-amber: #d99a24;
    --fm-alert: #b42318;
}

body {
    background: var(--fm-page-bg);
    background-image: none;
    color: var(--fm-text);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

body::before {
    display: none;
}

@supports (padding: max(0px)) {
    body {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }
}

#app-content {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0.75rem;
}

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
    width: min(calc(100% - 1.5rem), 1440px);
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.25rem 0 7.5rem;
    overflow-x: hidden;
    box-sizing: border-box;
}

.dashboard-container > * {
    box-sizing: border-box;
}

.dashboard-container .content-container {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    background: transparent;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

.dashboard-page-hero,
.kpi-row {
    width: 100%;
}

.app-page-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.dashboard-page-hero {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
    background: linear-gradient(135deg, #ffffff 0%, #e6efe2 100%);
    border: 1px solid var(--fm-border);
    border-radius: 24px;
    padding: 1.6rem 2rem;
    box-shadow: 0 14px 30px rgba(31, 37, 32, 0.08);
}

.dashboard-page-hero__brand {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-page-hero__copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
}

.brand-logo--app-page {
    display: block;
    max-width: 220px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.page-kicker {
    margin: 0 0 0.35rem;
    color: var(--fm-green);
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.dashboard-page-title {
    margin: 0;
    padding-bottom: 0;
    color: var(--fm-green-dark);
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 900;
    letter-spacing: -0.055em;
    line-height: 0.95;
    text-align: left;
    text-shadow: none;
    text-transform: none;
    display: block;
}

.dashboard-page-title::after {
    display: none;
}

.page-subtitle {
    margin: 0.75rem 0 0;
    color: var(--fm-muted);
    font-size: clamp(0.98rem, 1.5vw, 1.08rem);
    line-height: 1.5;
    font-weight: 400;
    max-width: 720px;
}

.beta-user-notice {
    width: 100%;
}

.beta-user-notice[hidden] {
    display: none;
}

.beta-user-notice__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.75rem;
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: 12px;
    padding: 0.7rem 1rem;
    box-shadow: 0 4px 12px rgba(31, 37, 32, 0.04);
}

.beta-user-notice__title {
    margin: 0;
    color: var(--fm-green-dark);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.beta-user-notice__text {
    margin: 0;
    color: var(--fm-muted);
    font-size: 0.88rem;
    line-height: 1.4;
    flex: 1 1 16rem;
}

.farm-data-migration-banner {
    width: 100%;
}

.farm-data-migration-banner__inner {
    background: linear-gradient(135deg, var(--fm-surface-soft) 0%, var(--fm-green-soft) 100%);
    border: 1px solid var(--fm-border);
    border-radius: 18px;
    padding: 1.35rem 1.5rem;
    box-shadow: 0 10px 24px rgba(31, 37, 32, 0.08);
}

.farm-data-migration-banner__title {
    margin: 0 0 0.65rem;
    color: var(--fm-green-dark);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 700;
    line-height: 1.35;
}

.farm-data-migration-banner__support {
    margin: 0 0 1.1rem;
    color: var(--fm-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 56rem;
}

.farm-data-migration-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.farm-data-migration-banner .action-button {
    flex: 1 1 12rem;
    min-width: 0;
    margin-bottom: 0;
    border: 1px solid transparent;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(31, 37, 32, 0.08);
}

.farm-data-migration-banner .action-button:focus-visible {
    outline: 2px solid var(--fm-green);
    outline-offset: 2px;
}

.farm-data-migration-banner .btn-primary {
    background: var(--fm-green-dark);
    color: #ffffff;
    border-color: var(--fm-green-dark);
}

.farm-data-migration-banner .btn-primary:hover:not(:disabled) {
    background: var(--fm-green);
    border-color: var(--fm-green);
}

.farm-data-migration-banner .btn-secondary {
    background: var(--fm-surface);
    color: var(--fm-green-dark);
    border-color: var(--fm-border);
}

.farm-data-migration-banner .btn-secondary:hover:not(:disabled) {
    background: var(--fm-green-soft);
    border-color: var(--fm-green);
}

.farm-data-migration-banner__status {
    margin: 0.85rem 0 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.farm-data-migration-banner__status[hidden] {
    display: none;
}

.farm-data-migration-banner__status--success {
    color: var(--fm-green-dark);
    font-weight: 600;
}

.farm-data-migration-banner__status--error {
    color: var(--fm-text);
    font-weight: 500;
}

.edit-profile-button {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 0.75rem;
    padding: 0.75rem 1.35rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--fm-green-dark);
    border: 1px solid var(--fm-green-dark);
    border-radius: 7px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.edit-profile-button:hover {
    background: var(--fm-green);
    border-color: var(--fm-green);
    text-decoration: none;
    color: #ffffff;
}
.edit-profile-button:active {
    transform: scale(0.98);
}

.stat-card {
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 10px 24px rgba(31, 37, 32, 0.06);
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

.stat-card h3 {
    margin-top: 0;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.kpi-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: inherit;
}
.kpi-card-link:hover {
    background: transparent;
}
.kpi-card-link:focus-visible {
    outline: 2px solid var(--fm-green);
    outline-offset: 2px;
}

.kpi-card {
    position: relative;
    overflow: hidden;
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: 18px;
    padding: 1rem;
    margin-bottom: 0;
    min-height: 120px;
    min-width: 0;
    box-shadow: 0 10px 24px rgba(31, 37, 32, 0.07);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--fm-green-dark), var(--fm-green));
}

.kpi-card-link:hover .kpi-card {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(31, 37, 32, 0.12);
    border-color: rgba(47, 107, 47, 0.35);
}

.kpi-card--low::before {
    background: linear-gradient(90deg, var(--fm-amber), #8a6d1f);
}

.kpi-card--alert::before {
    background: linear-gradient(90deg, var(--fm-alert), var(--fm-amber));
}

.kpi-card--critical::before {
    background: linear-gradient(90deg, var(--fm-alert), var(--fm-amber));
}

.kpi-card--alert .kpi-number,
.kpi-card--critical .kpi-number {
    color: var(--fm-alert);
}

.kpi-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--fm-muted);
    text-transform: uppercase;
    margin-bottom: 0;
}

.kpi-number {
    margin-top: 0.5rem;
    font-size: clamp(1.45rem, 4vw, 2rem);
    font-weight: 800;
    color: var(--fm-green-dark);
}

.kpi-sub {
    margin-top: 0.3rem;
    font-size: 0.82rem;
    color: var(--fm-muted);
    opacity: 1;
}

.kpi-sub-discrepancy {
    color: var(--fm-alert);
}

/* Operational overview - 2-column grid */
.operational-overview {
    margin-bottom: 15px;
}

.operational-overview .section-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--fm-green-dark, #234f2e);
    margin: 0 0 12px 0;
}

.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Operational overview: full-width animal breakdown, then collapsible stack */
.overview-grid--operational {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.overview-animal-full {
    width: 100%;
}

.overview-collapsibles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 700px) {
    .overview-grid {
        grid-template-columns: 1fr;
    }
}

/* KPI responsive grid – see brand overrides at end of file */

.overview-left,
.overview-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.overview-card {
    margin-bottom: 0;
}

.overview-card .overview-stat {
    font-size: 1.5rem;
    margin: 6px 0 8px 0;
}

/* Sales/Purchases overview - compact cards */
.sales-purchases-overview .section-title {
    margin-bottom: 12px;
}

.sales-compact h3,
.purchases-compact h3 {
    margin-bottom: 6px;
}

.sales-compact .overview-select,
.purchases-compact .overview-select {
    float: right;
    padding: 4px 8px;
    font-size: 0.8rem;
    margin-top: -4px;
    margin-bottom: 4px;
}

.sales-compact .overview-stat,
.purchases-compact .overview-stat {
    font-size: 1.35rem;
    margin: 4px 0 6px 0;
}

.sales-compact .overview-meta,
.purchases-compact .overview-meta {
    font-size: 0.85rem;
    margin: 4px 0 8px 0;
    color: var(--text-secondary, #7f8c8d);
}

.sales-compact .overview-last,
.purchases-compact .overview-last {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.sales-compact .transaction-label,
.purchases-compact .transaction-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #7f8c8d);
    margin: 0 0 2px 0;
}

.sales-compact .transaction-details,
.purchases-compact .transaction-details {
    font-size: 0.9rem;
    margin: 0;
}

/* Compact animal breakdown list – dividers + micro bars */
.breakdown-compact .inventory-item {
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.breakdown-compact .inventory-item:last-child {
    border-bottom: none;
}

.breakdown-compact .main-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.breakdown-compact .inventory-category {
    font-size: 0.85rem;
    min-width: 4em;
}

.breakdown-compact .inventory-bar-wrap {
    flex: 1;
    min-width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.breakdown-compact .inventory-bar-track {
    width: 100%;
    height: 6px;
    background: var(--fm-green-soft, #e6efe2);
    border-radius: 999px;
    overflow: hidden;
}

.breakdown-compact .inventory-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--fm-green-dark, #234f2e), var(--fm-green, #2f6b2f));
    border-radius: 999px;
    width: 0;
    transition: width 0.2s ease;
}

.breakdown-compact .inventory-pct {
    font-size: 0.6rem;
    color: var(--fm-green-dark, #234f2e);
    font-weight: 700;
}

.breakdown-compact .inventory-count {
    font-size: 0.8rem;
    color: var(--fm-green-dark, #234f2e);
    font-weight: 700;
    flex-shrink: 0;
}

.breakdown-compact .location-breakdown {
    font-size: 0.75rem;
    padding-left: 12px;
    margin-top: 2px;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

/* Combined feed card */
/* Feed status collapsible */
.feed-collapsible {
    list-style: none;
}

.feed-collapsible-summary {
    list-style: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;
    color: var(--fm-green-dark, #234f2e);
    padding: 1rem;
    margin: 0;
    border-bottom: 1px solid var(--fm-border, #cfd8c6);
}

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

.feed-collapsible-summary::before {
    content: '▸ ';
    display: inline-block;
    width: 1em;
    transition: transform 0.15s ease;
}

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

.feed-collapsible-body {
    margin-top: 0;
    padding: 1rem;
}

.feed-combined #feed-status {
    margin-bottom: 12px;
}

.feed-combined .feed-status-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.feed-calc-inline {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.9rem;
}

/* Stock discrepancies - collapsible; when none, hide body but keep section visible */
.discrepancies-card.collapsed-none .discrepancies-body {
    display: none;
}

.discrepancies-card.collapsed-none summary {
    margin-bottom: 0;
}

/* Detail section - one row of collapsibles, match operational overview sizing */
.detail-section {
    margin-top: 8px;
    margin-bottom: 15px;
}

.detail-section-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--fm-green-dark, #234f2e);
    margin: 0 0 10px 0;
}

.detail-collapsibles-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.detail-collapsibles-row .detail-collapsible {
    background: var(--fm-surface, #ffffff);
    border-radius: 18px;
    padding: 0;
    box-shadow: 0 10px 24px rgba(31, 37, 32, 0.06);
    border: 1px solid var(--fm-border, #cfd8c6);
    margin-bottom: 0;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0;
}

.detail-collapsibles-row .detail-summary {
    list-style: none;
    padding: 1rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--fm-green-dark, #234f2e);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid var(--fm-border, #cfd8c6);
}

.detail-collapsibles-row .detail-summary::-webkit-details-marker {
    display: none;
}

.detail-collapsibles-row .detail-summary::before {
    content: '▸ ';
    display: inline-block;
    width: 1em;
    transition: transform 0.15s ease;
}

.detail-collapsibles-row .detail-collapsible[open] .detail-summary::before {
    transform: rotate(90deg);
}

.detail-collapsibles-row .detail-body {
    margin-top: 0;
    padding: 1rem;
    border-top: none;
}

@media (max-width: 640px) {
    .detail-collapsibles-row {
        grid-template-columns: 1fr;
    }
}

.detail-body .no-data {
    margin: 10px 0 4px 0;
    font-size: 0.9rem;
    color: var(--text-secondary, #7f8c8d);
}

.detail-subheading {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #7f8c8d);
    margin: 12px 0 6px 0;
}

.detail-subheading:first-child {
    margin-top: 4px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--fm-green-dark, #234f2e);
    margin: 10px 0;
}

#currency-select {
    float: right;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f8f9fa;
    font-size: 0.9rem;
    margin-top: -5px;
}

.inventory-item {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.inventory-item:last-child {
    border-bottom: none;
}

.main-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-category {
    font-weight: 500;
    color: var(--text-primary);
}

.inventory-count {
    font-weight: 600;
    color: var(--accent-color);
}

.location-breakdown {
    margin-top: 5px;
    padding-left: 15px;
    font-size: 0.85rem;
}

.location-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    color: var(--text-secondary);
}

.location-name {
    font-style: italic;
}

.location-count {
    font-weight: 500;
}

.summary-by-property {
    margin-top: 10px;
    margin-bottom: 8px;
}

.summary-by-property-container {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.summary-by-property-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--text-secondary);
}

.summary-by-property-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-by-property-item {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.summary-by-property-item .property-name {
    font-weight: bold;
    font-style: italic;
}

.summary-by-property-item .property-count {
    font-weight: 600;
    color: var(--accent-color);
}

/* Stock discrepancies: 3 cards per row, max 6, same size as activity cards */
#stock-discrepancies {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

#stock-discrepancies .no-data,
#stock-discrepancies .show-more {
    grid-column: 1 / -1;
}

.discrepancy-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 10px 8px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    height: 130px;
    box-sizing: border-box;
}

.discrepancy-details {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.discrepancy-category {
    font-weight: bold;
    font-size: 0.75rem;
    color: #2c3e50;
    margin-bottom: 2px;
}

.discrepancy-date {
    font-size: 0.7rem;
    color: #7f8c8d;
}

#stock-discrepancies .counter-name {
    font-size: 0.7rem;
    color: #7f8c8d;
    margin-top: 2px;
    font-style: italic;
}

.discrepancy-counts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.78rem;
    flex: 1;
    min-height: 0;
}

#stock-discrepancies .expected-count,
#stock-discrepancies .actual-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
}

.expected-count span, .actual-count span {
    font-weight: bold;
}

.expected-count {
    color: #7f8c8d;
}

.actual-count {
    color: #e74c3c;
}

.negative-diff {
    color: #e74c3c;
}

.positive-diff {
    color: #2ecc71;
}

/* Recent activities: 3 cards per row, max 6 */
#activities-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

#activities-list .no-data {
    grid-column: 1 / -1;
}

/* Activity items styling (cards in grid) - fixed height to match feed cards */
.activity-item {
    padding: 10px 8px;
    border-radius: 8px;
    background-color: #f8f9fa;
    border-left: 4px solid #2f6b2f; /* Default color */
    height: 130px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#activities-list .activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-shrink: 0;
}

#activities-list .activity-category {
    font-size: 0.75rem;
    font-weight: 600;
    color: #2c3e50;
}

.activity-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.activity-text {
    font-weight: 500;
    color: #2c3e50;
    flex: 1;
    margin-right: 8px;
}

.activity-date {
    color: #7f8c8d;
    font-size: 0.7rem;
    white-space: nowrap;
}

#activities-list .activity-details {
    color: #34495e;
    font-size: 0.8rem;
    line-height: 1.3;
    margin: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

#activities-list .activity-financial {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #eee;
    flex-shrink: 0;
}

.activity-financial .price {
    color: #7f8c8d;
}

.activity-financial .total {
    font-weight: 600;
}

.activity-financial .income {
    color: #27ae60;
}

.activity-financial .expense {
    color: #e74c3c;
}

/* Activity type-specific styling */
.activity-add {
    border-left-color: #2ecc71;
}

.activity-sell, .activity-sale {
    border-left-color: #e74c3c;
}

.activity-buy, .activity-purchase {
    border-left-color: #2f6b2f;
}

.activity-move, .activity-movement {
    border-left-color: #f1c40f;
}

.activity-death {
    border-left-color: #95a5a6;
}

.activity-birth {
    border-left-color: #9b59b6;
}

.activity-resolution {
    border-left-color: #2ecc71; /* Green to indicate successful resolution */
}

.activity-feed-purchase, .activity-feed-usage {
    border-left-color: #e67e22;
}

.activity-health, .activity-vaccination, .activity-treatment, .activity-medication {
    border-left-color: #1abc9c;
}

.activity-stock-count {
    border-left-color: #34495e;
}

.activity-reversal {
    border-left-color: #e74c3c;
}

/* Special styling for the feed status card */
.stat-card.full-width-stat {
    /* Remove margin overrides that cause misalignment */
    width: calc(100% - 30px) !important; /* Match content-container width */
    max-width: 100% !important;
    box-sizing: border-box !important;
    /* Use the same margins as content-container */
    margin: 15px !important;
    padding: 20px !important;
}

/* Feed status container */
#feed-status {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Feed status grid layout: 3 cards per row, max 6 items */
.feed-status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Feed item styling - same fixed size as activity cards */
.feed-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 10px 8px;
    height: 130px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
}

.feed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.feed-name {
    font-weight: bold;
    font-size: 0.85rem;
    color: #2c3e50;
}

.feed-quantity {
    font-weight: bold;
    font-size: 0.85rem;
}

.quantity-low {
    color: #8a5a00;
    font-weight: 700;
}

.quantity-good {
    color: var(--fm-green, #2f6b2f);
    font-weight: 700;
}

.feed-details {
    font-size: 0.78rem;
    color: #7f8c8d;
    line-height: 1.35;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* Feed Status Colors */
.low-feed {
    background-color: var(--fm-surface-soft, #f8f9f4);
    border-color: rgba(217, 154, 36, 0.45);
    border-left: 4px solid var(--fm-amber, #d99a24);
}

.good-feed {
    background-color: var(--fm-surface, #ffffff);
    border-color: rgba(47, 107, 47, 0.28);
    border-left: 4px solid var(--fm-green, #2f6b2f);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .feed-item {
        padding: 10px;
    }
    
    .feed-name,
    .feed-quantity {
        font-size: 1rem;
    }
    
    .feed-details {
        font-size: 0.85rem;
    }
}

@media (min-width: 1200px) {
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Portrait mode adjustments */
@media screen and (orientation: portrait) {
    .dashboard-container {
        padding: 10px;
        padding-bottom: 7.75rem;
    }
    
    .stat-card {
        padding: 15px;
        width: calc(100% - 30px) !important; /* Match content-container width */
        margin: 15px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape mode adjustments */
@media screen and (orientation: landscape) {
    .health-status-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Media queries for responsiveness */
@media (min-width: 768px) {
    .stat-cards-row {
        display: flex;
        gap: 15px;
    }
    
    .stat-cards-row .stat-card {
        flex: 1;
    }
}

@media (max-width: 400px) {
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-card h3 {
        font-size: 1rem;
    }
}

/* Feed calculations: 3 cards per row, max 6, same size as activity cards */
#feed-calculations {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

#feed-calculations .no-data,
#feed-calculations .show-more {
    grid-column: 1 / -1;
}

.calculation-item {
    display: flex;
    flex-direction: column;
    padding: 10px 8px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2f6b2f;
    height: 130px;
    box-sizing: border-box;
}

.calculation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.calculation-title {
    font-weight: bold;
    font-size: 0.75rem;
    color: #2c3e50;
}

.calculation-result {
    font-weight: bold;
    font-size: 0.75rem;
    color: #2f6b2f;
}

#feed-calculations .calculation-details {
    font-size: 0.78rem;
    color: #7f8c8d;
    line-height: 1.3;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.calculation-main-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

#feed-calculations .per-animal {
    font-weight: bold;
    color: #2ecc71;
    background-color: rgba(46, 204, 113, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.calculation-method {
    margin-top: 2px;
    color: #34495e;
}

.calculation-notes {
    margin-top: 4px;
    font-style: italic;
    padding-top: 4px;
    border-top: 1px dashed #eee;
}

#feed-calculations .calculation-date {
    margin-top: 2px;
    color: #95a5a6;
    font-size: 0.7rem;
}

/* Sales display styling */
.sales-list {
    margin-top: 10px;
}

.sale-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #e74c3c;
}

.latest-sale {
    border-left-color: #27ae60;
}

.sale-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sale-category {
    font-weight: bold;
    color: #2c3e50;
}

.sale-amount {
    font-weight: bold;
    color: #27ae60;
}

.sale-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.sale-info {
    display: flex;
    flex-direction: column;
}

.sale-date, .sale-buyer {
    color: #34495e;
    margin-bottom: 3px;
}

.sale-pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.price-per-unit {
    color: #7f8c8d;
}

.sale-notes {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed #eee;
    font-style: italic;
}

.more-sales {
    text-align: center;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
    padding: 5px 0;
}

/* Purchase display styling */
.purchases-list {
    margin-top: 10px;
}

.purchase-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 4px solid #2f6b2f;
}

.latest-purchase {
    border-left-color: #2980b9;
}

.purchase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.purchase-category {
    font-weight: bold;
    color: #2c3e50;
}

.purchase-amount {
    font-weight: bold;
    color: #2f6b2f;
}

.purchase-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.purchase-info {
    display: flex;
    flex-direction: column;
}

.purchase-date, .purchase-supplier {
    color: #34495e;
    margin-bottom: 3px;
}

.purchase-pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.purchase-notes {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed #eee;
    font-style: italic;
}

.more-purchases {
    text-align: center;
    font-size: 0.85rem;
    color: #7f8c8d;
    font-style: italic;
    padding: 5px 0;
}

/* Health Summary Section */
.health-summary {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 3px solid #2f6b2f;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.summary-stat {
    flex: 1;
    padding: 10px;
    border-right: 1px solid #eee;
}

.summary-stat:last-child {
    border-right: none;
}

.summary-stat.alert .stat-value {
    color: #e74c3c;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 5px;
}

/* Health Status Content Styles - 3 cards per row, max 6 per section, same card size */
#health-status .health-status-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

#health-status .health-stat {
    background-color: transparent;
    border-radius: 0;
    padding: 0 0 12px 0;
    width: 100%;
    min-width: 0;
}

.health-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.health-stat-title {
    font-weight: bold;
    color: #2c3e50;
}

.health-stat-count {
    background-color: #dfe6e9;
    color: #2c3e50;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Health Issues / Health records: 3 cards per row, same size cards - scoped to #health-status */
#health-status .health-details {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
    width: 100%;
}

#health-status .health-details li {
    padding: 10px 8px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #1abc9c;
    height: 130px !important;
    min-height: 130px;
    max-height: 130px;
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column;
    width: 100%;
}

#health-status .health-details li.show-more {
    grid-column: 1 / -1;
    height: auto !important;
    min-height: 0;
    max-height: none;
    background-color: transparent;
    border-left: none;
    padding: 8px 0;
}

#health-status .health-details .record-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    flex-shrink: 0;
    font-size: 0.8rem;
}

#health-status .health-details .record-date {
    font-size: 0.7rem;
    color: #7f8c8d;
}

#health-status .health-details .record-details {
    font-size: 0.78rem;
    color: #34495e;
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#health-status .health-details .description {
    width: 100%;
    margin: 2px 0 0;
    color: #7f8c8d;
    font-style: italic;
    font-size: 0.75rem;
}

/* Severity badges */
.severity-badge, .status-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: capitalize;
}

.severity-badge.severity-mild {
    background-color: #ebf5fb;
    color: #2f6b2f;
}

.severity-badge.severity-moderate {
    background-color: #fef5e7;
    color: #f39c12;
}

.severity-badge.severity-severe {
    background-color: #fadbd8;
    color: #e74c3c;
}

.severity-badge.severity-unknown {
    background-color: #eaecee;
    color: #7f8c8d;
}

/* Treatment & Medication styles */
.status-badge {
    background-color: #e8f8f5;
    color: #1abc9c;
}

.treatment.completed .status-badge {
    background-color: #eaecee;
    color: #7f8c8d;
}

.dosage, .due-date, .end-date {
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* Vaccinations / meds: 3 cards per row, max 6, same card size */
.detail-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.vm-card {
    padding: 10px 8px;
    background-color: #f8f9fa;
    border-radius: 8px;
    height: 130px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.vm-card.vaccination {
    border-left: 4px solid #2f6b2f;
}

.vm-card.medication {
    border-left: 4px solid #9b59b6;
}

.vm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.vm-card-category {
    font-weight: bold;
    font-size: 0.75rem;
    color: #2c3e50;
}

.vm-card-date {
    font-size: 0.7rem;
    color: #7f8c8d;
}

.vm-card-details {
    font-size: 0.8rem;
    color: #34495e;
    flex: 1;
    min-height: 0;
}

#vaccinations-meds .show-more {
    margin-top: 8px;
}

.show-more {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 5px 0;
}

/* Responsive adjustments - 3 cards per row */
@media screen and (max-width: 480px) {
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media screen and (min-width: 769px) {
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media screen and (orientation: landscape) {
    .feed-status-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Fix for feed status alignment - this must override any other styles */
.dashboard-container .stat-card.content-container.full-width-stat {
    width: 100% !important;
    margin: 0 0 1rem !important;
    padding: 1.25rem !important;
    box-sizing: border-box !important;
    max-width: none !important;
    left: 0 !important;
    right: 0 !important;
    position: relative !important;
}

/* === Farm Manager brand overrides (homepage-aligned) === */

.dashboard-container .content-container {
    background: transparent;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.dashboard-container h2,
.dashboard-container h3 {
    text-shadow: none;
    text-transform: none;
    letter-spacing: -0.01em;
}

.dashboard-container h2:after,
.dashboard-container .stat-card h3::after,
.dashboard-container .page-header h2:after {
    background: linear-gradient(90deg, var(--fm-green-dark), var(--fm-green));
}

.dashboard-container .stat-card h3 {
    background: var(--fm-green-soft);
    color: var(--fm-green-dark);
    box-shadow: none;
}

.dashboard-container .overview-card,
.dashboard-container .feed-collapsible,
.dashboard-container .activity-item,
.dashboard-container .feed-item,
.dashboard-container .sale-item,
.dashboard-container .purchase-item,
.dashboard-container .calculation-item,
.dashboard-container .discrepancy-item,
.dashboard-container #health-status .health-stat,
.dashboard-container #health-status .health-details li,
.dashboard-container .vm-card {
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: 18px;
    box-shadow: 0 10px 24px rgba(31, 37, 32, 0.06);
}

.dashboard-container .feed-collapsible,
.dashboard-container .overview-card {
    overflow: hidden;
}

.dashboard-container .logout-button {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 0.75rem 1.35rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--fm-green-dark);
    background: var(--fm-surface);
    border: 1px solid var(--fm-border);
    border-radius: 7px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.dashboard-container .logout-button:hover {
    background: var(--fm-green-soft);
    border-color: var(--fm-green);
    transform: none;
    box-shadow: none;
}

.dashboard-container .severity-badge,
.dashboard-container .status-badge {
    border-radius: 999px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.dashboard-container .inventory-bar-track {
    background: var(--fm-green-soft);
    border-radius: 999px;
}

.dashboard-container .inventory-bar {
    background: linear-gradient(90deg, var(--fm-green-dark), var(--fm-green));
    border-radius: 999px;
}

.dashboard-container .inventory-pct,
.dashboard-container .inventory-count {
    color: var(--fm-green-dark);
    font-weight: 700;
}

@media (max-width: 1100px) {
    .kpi-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .dashboard-page-hero {
        grid-template-columns: 1fr;
        gap: 1.1rem;
        padding: 1.35rem 1.25rem;
        text-align: center;
    }

    .dashboard-page-hero__copy {
        text-align: center;
        align-items: center;
    }

    .dashboard-page-title {
        font-size: clamp(2.3rem, 12vw, 3.4rem);
        text-align: center;
    }

    .page-subtitle {
        max-width: 34rem;
    }

    .farm-data-migration-banner__inner {
        padding: 1.15rem 1.1rem;
    }

    .farm-data-migration-banner__actions {
        flex-direction: column;
    }

    .farm-data-migration-banner .action-button {
        flex: 1 1 auto;
        width: 100%;
    }

    .brand-logo--app-page {
        max-width: 180px;
    }

    .kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-grid,
    .detail-collapsibles-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .kpi-row {
        grid-template-columns: 1fr;
    }
} 