/* HofRechner CSS Design-System */

:root {
    /* Fonts */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Light Theme Palette (Default) */
    --color-bg-base: #f4f6f3; /* Sehr leichtes Löss-Grüngrau */
    --color-bg-card: rgba(255, 255, 255, 0.9);
    --color-border: rgba(143, 161, 140, 0.2);
    
    /* Brand Accent Colors */
    --color-brand-primary: #2d5a27; /* Kräftiges Tannen/Wiesengrün */
    --color-brand-primary-hover: #1e3f19;
    --color-brand-secondary: #e6a100; /* Goldgelb für Eier/Sonne */
    --color-brand-accent: #b23b3b; /* Fleischrot/Rostrot */
    
    /* Text */
    --color-text-main: #2b352a; /* Sehr dunkles Olivschwarz */
    --color-text-muted: #5e6b5c;
    --color-text-white: #ffffff;
    
    /* Semantics */
    --color-success: #1e7a3c;
    --color-success-bg: rgba(30, 122, 60, 0.1);
    --color-danger: #b23b3b;
    --color-danger-bg: rgba(178, 59, 59, 0.1);
    --color-warning: #c28700;
    --color-warning-bg: rgba(194, 135, 0, 0.1);

    /* Shadows & Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 30px rgba(45, 90, 39, 0.08);
    --shadow-lg: 0 12px 40px rgba(45, 90, 39, 0.12);
    --blur-glass: 16px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Overrides */
.dark-theme {
    --color-bg-base: #0f150e; /* Tiefes Waldschwarz */
    --color-bg-card: rgba(22, 33, 21, 0.94);
    --color-border: rgba(143, 161, 140, 0.1);
    
    --color-brand-primary: #4e8c47; /* Helles Tannengrün */
    --color-brand-primary-hover: #67a65f;
    --color-brand-secondary: #ffb700;
    --color-brand-accent: #e05e5e;
    
    --color-text-main: #e2e8e1; /* Leichtes Grau-Oliv */
    --color-text-muted: #95a593;
    
    --color-success: #3ab063;
    --color-success-bg: rgba(58, 176, 99, 0.15);
    --color-danger: #e05e5e;
    --color-danger-bg: rgba(224, 94, 94, 0.15);
    --color-warning: #ffb700;
    --color-warning-bg: rgba(255, 183, 0, 0.15);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    
    color-scheme: dark;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg-base);
    color: var(--color-text-main);
    line-height: 1.5;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    background-image: radial-gradient(circle at 10% 20%, rgba(45, 90, 39, 0.03) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(230, 161, 0, 0.02) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: var(--color-bg-card);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.logo-icon {
    font-size: 2.2rem;
    animation: sway 4s ease-in-out infinite alternate;
    display: inline-block;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 0;
    background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    background: var(--color-brand-primary);
    color: var(--color-text-white);
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 0 0 auto;
}

@media (max-width: 720px) {
    .app-header {
        padding: 1rem;
        align-items: flex-start;
        flex-direction: column;
    }

    .app-header h1 {
        font-size: 1.45rem;
    }

    .badge {
        font-size: 0.68rem;
    }

    .header-controls {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Main Container Layout */
.app-container {
    max-width: 1450px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 390px 1fr;
    gap: 2rem;
    flex: 1;
}

.app-container > *,
.side-panel,
.main-dashboard,
.card {
    min-width: 0;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        margin: 1rem auto;
    }
}

@media (max-width: 640px) {
    .app-container {
        padding: 0 0.75rem;
    }

    .card {
        padding: 1.1rem;
    }
}

/* Panels */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.main-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Cards & Glassmorphism */
.card {
    border-radius: var(--radius-md);
    padding: 1.75rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
}

.card.glass {
    background: var(--color-bg-card);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: rgba(143, 161, 140, 0.3);
}

h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0;
}

.section-desc {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: -0.75rem;
    margin-bottom: 1.5rem;
}

/* Forms styling */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

.form-grid .form-group label {
    min-height: 2.35em;
    display: flex;
    align-items: flex-end;
}

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

    .form-grid .form-group label {
        min-height: 0;
    }
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.4);
    color: var(--color-text-main);
    transition: var(--transition);
}

.dark-theme input[type="text"],
.dark-theme input[type="number"],
.dark-theme select {
    background: rgba(0, 0, 0, 0.2);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--color-brand-primary);
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.15);
    background: rgba(255, 255, 255, 0.8);
}

.dark-theme input[type="text"]:focus,
.dark-theme input[type="number"]:focus,
.dark-theme select:focus {
    background: rgba(0, 0, 0, 0.4);
}

.input-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-unit input {
    padding-right: 2.5rem;
}

.input-unit .unit {
    position: absolute;
    right: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.input-helper {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Custom indicator for overridden inputs */
input.custom-modified {
    border-color: var(--color-brand-secondary) !important;
    background: rgba(230, 161, 0, 0.05) !important;
}

/* Tierbestand / Livestock Card Items */
.livestock-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.animal-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.animal-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(143, 161, 140, 0.08);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.animal-toggle:hover {
    border-color: rgba(143, 161, 140, 0.35);
    background: rgba(143, 161, 140, 0.13);
}

.animal-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-brand-primary);
    flex: 0 0 auto;
}

.animal-toggle:has(input:checked) {
    color: var(--color-text-main);
    border-color: rgba(45, 90, 39, 0.35);
    background: rgba(45, 90, 39, 0.1);
}

.dark-theme .animal-toggle:has(input:checked) {
    border-color: rgba(78, 140, 71, 0.45);
    background: rgba(78, 140, 71, 0.16);
}

@media (max-width: 520px) {
    .animal-picker {
        grid-template-columns: 1fr;
    }
}

.livestock-card-item {
    background: rgba(143, 161, 140, 0.08);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    transition: var(--transition);
}

.livestock-card-item:hover {
    background: rgba(143, 161, 140, 0.12);
    border-color: rgba(143, 161, 140, 0.3);
}

.livestock-card-item.inactive {
    opacity: 0.65;
    border-style: dashed;
}

.livestock-card-item.active-szenario {
    opacity: 1;
    border-style: solid;
    border-color: var(--color-brand-secondary);
    background: rgba(230, 161, 0, 0.03);
    box-shadow: 0 0 12px rgba(230, 161, 0, 0.08);
}

.livestock-card-item.animal-hidden {
    display: none;
}

.livestock-card-item.collapsed {
    gap: 0;
}

.livestock-card-item.collapsed > :not(.livestock-main-row) {
    display: none !important;
}

.livestock-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Sub-row for Bio & Breed dropdowns */
.livestock-sub-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--color-border);
}

/* Dreispaltiges Sub-Grid für die erweiterte Rinderkarte */
.livestock-sub-row.rinder-three-cols {
    grid-template-columns: 1fr;
}

.livestock-sub-row.hennen-three-cols {
    grid-template-columns: 1fr;
}

.form-group-sub {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.form-group-sub label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.form-group-sub select {
    min-width: 0;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.6);
}

.form-group-sub input[type="number"] {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.dark-theme .form-group-sub select {
    background: rgba(0, 0, 0, 0.3);
}

/* Rassen-Infobox */
.breed-info-box {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.6rem;
    background: rgba(45, 90, 39, 0.06);
    padding: 0.4rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    border: 1px solid rgba(45, 90, 39, 0.1);
    flex-wrap: wrap;
}

.card-inline-warning {
    display: grid;
    gap: 0.18rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(178, 59, 59, 0.28);
    background: var(--color-danger-bg);
    color: var(--color-text-main);
    font-size: 0.8rem;
}

.card-inline-warning strong {
    color: var(--color-danger);
    font-size: 0.82rem;
}

.card-inline-warning span {
    color: var(--color-text-muted);
    line-height: 1.35;
}

.mode-note {
    display: grid;
    gap: 0.18rem;
    padding: 0.68rem 0.78rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(143, 161, 140, 0.08);
    font-size: 0.8rem;
}

.mode-note strong {
    color: var(--color-text-main);
    font-size: 0.84rem;
}

.mode-note span {
    color: var(--color-text-muted);
    line-height: 1.35;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--color-text-main);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
}

.inline-check input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-brand-primary);
}

.mode-note.milk-mode {
    border-color: rgba(30, 122, 60, 0.26);
    background: var(--color-success-bg);
}

.rinder-market-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: stretch;
    min-width: 0;
}

.rinder-market-controls .form-group-sub,
.comparison-box {
    margin-bottom: 0;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(143, 161, 140, 0.08);
}

.rinder-market-controls .form-group-sub select {
    width: 100%;
}

.comparison-box {
    display: grid;
    gap: 0.22rem;
    font-size: 0.8rem;
}

.comparison-box strong {
    color: var(--color-text-main);
}

.comparison-box span {
    color: var(--color-text-muted);
    line-height: 1.35;
}

.hennen-market-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: stretch;
    min-width: 0;
}

.hennen-market-controls .form-group-sub {
    margin-bottom: 0;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(143, 161, 140, 0.08);
}

.hennen-market-controls .form-group-sub label {
    margin-bottom: 0.35rem;
}

.inline-label-help {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.inline-label-help label {
    margin-bottom: 0;
}

.mini-info-toggle {
    width: 22px;
    height: 22px;
    font-size: 0.72rem;
}

.mini-info-panel {
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    font-size: 0.78rem;
}

.mini-info-panel strong {
    color: var(--color-text-main);
}

.hennen-market-controls .form-group-sub select {
    width: 100%;
}

.info-divider {
    color: rgba(143, 161, 140, 0.4);
}

.item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 100%;
}

.item-header .icon {
    font-size: 1.8rem;
}

.title-desc h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.title-desc {
    min-width: 0;
}

.card-summary {
    display: block;
    max-width: 100%;
    color: var(--color-text-muted);
    font-size: 0.72rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.livestock-card-item.collapsed .card-summary {
    color: var(--color-text-main);
}

.info-toggle {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.45);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.info-toggle:hover,
.info-toggle[aria-expanded="true"] {
    color: var(--color-text-white);
    border-color: var(--color-brand-primary);
    background: var(--color-brand-primary);
}

.dark-theme .info-toggle {
    background: rgba(0, 0, 0, 0.25);
}

.collapse-toggle {
    min-width: 96px;
    height: 32px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.45);
    color: var(--color-text-main);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.collapse-toggle:hover {
    border-color: var(--color-brand-primary);
    background: rgba(45, 90, 39, 0.12);
}

.dark-theme .collapse-toggle {
    background: rgba(0, 0, 0, 0.25);
}

.animal-info-panel {
    border-top: 1px dashed var(--color-border);
    padding-top: 0.85rem;
    color: var(--color-text-muted);
    font-size: 0.86rem;
    max-width: 100%;
}

.animal-info-panel p {
    margin-bottom: 0;
}

.animal-info-panel ul {
    margin-left: 1.05rem;
    display: grid;
    gap: 0.35rem;
}

.calc-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.item-control {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--color-border);
    border-radius: 50px;
    padding: 2px;
}

.dark-theme .item-control {
    background: rgba(0, 0, 0, 0.3);
}

.btn-qty {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-qty:hover {
    background: rgba(143, 161, 140, 0.2);
}

.item-control input[type="number"] {
    width: 45px;
    text-align: center;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

/* Remove default input arrows */
.item-control input::-webkit-outer-spin-button,
.item-control input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tip-box {
    background: rgba(230, 161, 0, 0.08);
    border-left: 3px solid var(--color-brand-secondary);
    padding: 0.85rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--color-text-main);
}

.area-capacity-panel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    background: rgba(143, 161, 140, 0.08);
}

.area-capacity-head,
.area-capacity-details {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.area-capacity-head {
    align-items: center;
}

.mini-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.area-capacity-pill {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 800;
    background: rgba(143, 161, 140, 0.16);
}

.capacity-meter {
    height: 8px;
    border-radius: 999px;
    background: rgba(143, 161, 140, 0.18);
    overflow: hidden;
    margin: 0.85rem 0 0.65rem;
}

.capacity-meter span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--color-success);
    transition: var(--transition);
}

.area-capacity-details {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-text-muted);
}

.area-capacity-panel p {
    margin-top: 0.6rem;
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.area-capacity-panel.capacity-green {
    border-color: rgba(30, 122, 60, 0.35);
    background: var(--color-success-bg);
}

.area-capacity-panel.capacity-green .capacity-meter span {
    background: var(--color-success);
}

.area-capacity-panel.capacity-yellow {
    border-color: rgba(194, 135, 0, 0.4);
    background: var(--color-warning-bg);
}

.area-capacity-panel.capacity-yellow .capacity-meter span {
    background: var(--color-warning);
}

.area-capacity-panel.capacity-red {
    border-color: rgba(178, 59, 59, 0.4);
    background: var(--color-danger-bg);
}

.area-capacity-panel.capacity-red .capacity-meter span {
    background: var(--color-danger);
}

/* Custom Overrides Grid */
.overrides-layout {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.override-section {
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.override-section.cost-collapsed .overrides-grid {
    display: none;
}

.override-section:first-child {
    padding-top: 0;
    border-top: 0;
}

.override-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.override-section.cost-collapsed .override-section-header {
    margin-bottom: 0;
}

.override-section-header h3 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--color-text-main);
}

.override-section-header span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.override-collapse-toggle {
    min-width: 88px;
    height: 32px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: rgba(143, 161, 140, 0.08);
    color: var(--color-text-main);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
}

.override-collapse-toggle:hover {
    border-color: var(--color-brand-primary);
    background: rgba(45, 90, 39, 0.12);
}

.dark-theme .override-collapse-toggle {
    background: rgba(0, 0, 0, 0.25);
}

.overrides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    align-items: start;
}

.overrides-grid .form-group {
    margin-bottom: 0;
}

.misc-section .overrides-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
        "income expenses"
        "income-note expenses-note"
        "work work";
    column-gap: 1.25rem;
    row-gap: 1.2rem;
}

.misc-income {
    grid-area: income;
}

.misc-expenses {
    grid-area: expenses;
}

.misc-income-note {
    grid-area: income-note;
}

.misc-expenses-note {
    grid-area: expenses-note;
}

.work-hours-field {
    grid-area: work;
    max-width: 520px;
}

@media (max-width: 760px) {
    .misc-section .overrides-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "income"
            "income-note"
            "expenses"
            "expenses-note"
            "work";
    }
}

/* Dashboard summary row */
.dashboard-summary {
    display: grid;
    grid-template-columns: 1.35fr repeat(3, 1fr);
    gap: 1.5rem;
}

@media (min-width: 1025px) {
    .dashboard-summary {
        position: sticky;
        top: 118px;
        z-index: 80;
        gap: 0.9rem;
        padding: 0.75rem;
        border: 1px solid rgba(143, 161, 140, 0.24);
        border-radius: var(--radius-md);
        background: #f4f6f3;
        box-shadow: 0 18px 42px rgba(45, 90, 39, 0.18);
    }

    .dashboard-summary .kpi-card {
        padding: 1rem;
        border-color: rgba(143, 161, 140, 0.34);
        background: #ffffff;
        box-shadow: none;
    }

    .dashboard-summary .kpi-value {
        font-size: 1.75rem;
        margin: 0.15rem 0;
        white-space: nowrap;
    }

    .dashboard-summary .kpi-label {
        font-size: 0.72rem;
    }

    .dashboard-summary .kpi-subtitle,
    .dashboard-summary .kpi-trend {
        font-size: 0.74rem;
    }

    .dark-theme .dashboard-summary {
        border-color: rgba(143, 161, 140, 0.2);
        background: #0f150e;
        box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
    }

    .dark-theme .dashboard-summary .kpi-card {
        border-color: rgba(143, 161, 140, 0.2);
        background: #162115;
    }
}

@media (max-width: 900px) {
    .dashboard-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .dashboard-summary .kpi-card {
        padding: 1rem;
    }

    .dashboard-summary .kpi-value {
        font-size: 1.85rem;
        white-space: nowrap;
    }
}

@media (max-width: 520px) {
    .dashboard-summary {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.dark-theme .kpi-card {
    background: rgba(18, 30, 17, 0.88);
}

.kpi-card.primary-kpi {
    background: linear-gradient(135deg, rgba(45, 90, 39, 0.15) 0%, rgba(230, 161, 0, 0.08) 100%);
    border-color: rgba(45, 90, 39, 0.25);
}

.dark-theme .kpi-card.primary-kpi {
    background: linear-gradient(135deg, rgba(78, 140, 71, 0.22) 0%, rgba(255, 183, 0, 0.12) 100%), rgba(18, 30, 17, 0.97);
}

@media (min-width: 1025px) {
    .dashboard-summary .kpi-card {
        background: #ffffff;
    }

    .dark-theme .dashboard-summary .kpi-card,
    .dark-theme .dashboard-summary .kpi-card.primary-kpi {
        background: #162115;
    }
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
}

.kpi-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.kpi-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0.25rem 0;
}

.kpi-value.revenue {
    color: var(--color-success);
}

.kpi-value.expenses {
    color: var(--color-danger);
}

.kpi-value.good {
    color: var(--color-success);
}

.kpi-value.warn {
    color: var(--color-warning);
}

.kpi-card.primary-kpi .kpi-value {
    background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.kpi-trend {
    font-size: 0.85rem;
    font-weight: 600;
}

.kpi-trend.positive { color: var(--color-success); }
.kpi-trend.negative { color: var(--color-danger); }

.kpi-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Ampelsystem / Traffic Lights Grid */
.traffic-lights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.light-card {
    background: rgba(143, 161, 140, 0.08);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    transition: var(--transition);
}

.light-card:hover {
    background: rgba(143, 161, 140, 0.12);
}

.light-indicator {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #252b24;
    padding: 8px 6px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    opacity: 0.15;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.dot.red { background-color: #ff3b30; }
.dot.yellow { background-color: #ffcc00; }
.dot.green { background-color: #34c759; }

/* Active traffic light states */
.light-card.active-red .dot.red {
    opacity: 1;
    box-shadow: 0 0 12px #ff3b30, inset 0 1px 2px rgba(255,255,255,0.4);
}
.light-card.active-yellow .dot.yellow {
    opacity: 1;
    box-shadow: 0 0 12px #ffcc00, inset 0 1px 2px rgba(255,255,255,0.4);
}
.light-card.active-green .dot.green {
    opacity: 1;
    box-shadow: 0 0 12px #34c759, inset 0 1px 2px rgba(255,255,255,0.4);
}

.light-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.light-content h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.light-content .value {
    font-size: 1.25rem;
    font-weight: 700;
}

.light-content .comparison {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.animal-warnings {
    grid-column: 1 / -1;
    margin-top: 0;
    padding: 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: rgba(143, 161, 140, 0.06);
}

.animal-warnings-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.animal-warnings-head h3 {
    font-size: 1rem;
    font-weight: 800;
}

.animal-warnings-head span {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.animal-warnings-list {
    display: grid;
    gap: 0.65rem;
}

.animal-warning {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
    background: rgba(143, 161, 140, 0.08);
}

.animal-warning strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.animal-warning p,
.warning-empty {
    color: var(--color-text-muted);
    font-size: 0.82rem;
}

.animal-warning.warning-yellow {
    border-color: rgba(194, 135, 0, 0.38);
    background: var(--color-warning-bg);
}

.animal-warning.warning-red {
    border-color: rgba(178, 59, 59, 0.38);
    background: var(--color-danger-bg);
}

/* Sliders panel */
.card-header-with-badge {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-active {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--color-brand-primary-hover);
    color: var(--color-text-white);
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
    animation: blink 2s infinite alternate;
}

.sliders-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
}

.slider-val {
    color: var(--color-brand-primary);
}

/* Custom range input styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: var(--color-border);
    outline: none;
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-brand-primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--color-brand-primary-hover);
}

.slider-effect {
    font-size: 0.8rem;
    font-weight: 600;
}

.slider-effect.positive { color: var(--color-success); }
.slider-effect.negative { color: var(--color-danger); }
.slider-effect.neutral { color: var(--color-text-muted); }

.processing-control {
    display: grid;
    gap: 0.45rem;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(143, 161, 140, 0.08);
}

.processing-head,
.processing-scale {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.processing-head label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.processing-head strong {
    font-size: 0.86rem;
}

.processing-scale {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 700;
}

.processing-control input[type="range"] {
    width: 100%;
}

/* Financial Table */
.table-wrapper {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.financial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

.financial-table th, 
.financial-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.financial-table th {
    font-weight: 700;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-section-header td {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    background: rgba(143, 161, 140, 0.06);
    color: var(--color-brand-primary);
}

.table-sum-row td {
    font-weight: 700;
    border-top: 2px solid var(--color-brand-primary);
    background: rgba(143, 161, 140, 0.03);
}

.table-net-row td {
    font-weight: 800;
    font-size: 1.1rem;
    border-top: 3px double var(--color-brand-primary);
    background: linear-gradient(90deg, rgba(45, 90, 39, 0.05) 0%, rgba(230, 161, 0, 0.03) 100%);
}

.table-info-row td {
    font-weight: 700;
    background: rgba(45, 90, 39, 0.04);
    border-bottom: 3px double var(--color-brand-primary);
}

.text-right { text-align: right; }
.text-success { color: var(--color-success); font-weight: 600; }
.text-danger { color: var(--color-danger); font-weight: 600; }

.detail-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin: 0.12rem 0.25rem 0.12rem 0;
    padding: 0.16rem 0.42rem;
    border-radius: 999px;
    background: rgba(143, 161, 140, 0.12);
    border: 1px solid rgba(143, 161, 140, 0.18);
    color: var(--color-text);
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.35;
    white-space: normal;
}

.hidden { display: none !important; }

/* Footer */
.app-footer {
    text-align: center;
    padding: 2.5rem 1rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-card);
    margin-top: auto;
}

/* Animations */
@keyframes sway {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(10deg); }
}

@keyframes blink {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Custom Scrollbar for premium feel */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-base);
}

::-webkit-scrollbar-thumb {
    background: rgba(143, 161, 140, 0.3);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(45, 90, 39, 0.4);
}
