/* ========================================
   Tavuk Yaşam Döngüsü Yönetim Sistemi
   Tasarım kaynağı: repository kökündeki DESIGN.md (Stitch "Kümes Operasyon")
   ======================================== */

/* --- Temel --- */
html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 15px;
    }
}

body {
    min-height: 100vh;
    margin: 0;
}

/* --- Kenar menü iskeleti --- */
#sidebar {
    position: fixed;
    left: 0;
    z-index: 1030;
    overflow-x: hidden;
    overflow-y: auto;
    transition: all 0.3s ease;
}

#sidebar .sidebar-content {
    min-height: 100%;
    padding-bottom: 1rem;
}

#sidebar::-webkit-scrollbar {
    width: 8px;
}

#sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.34);
}

#sidebar.collapsed .link-text {
    display: none;
}

#sidebar.collapsed .sidebar-link {
    padding-right: 0;
    padding-left: 0;
    text-align: center;
}

#sidebar.collapsed .sidebar-link i {
    margin-right: 0 !important;
    font-size: 1.2rem;
}

.sidebar-link {
    white-space: nowrap;
    transition: all 0.2s ease;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.sidebar-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.sidebar-sub-link {
    padding: 0.4rem 1rem !important;
    font-size: max(12px, 0.85rem);
}

.sidebar-sub-link .bi-circle {
    font-size: 0.4rem;
    vertical-align: middle;
}

.sidebar-sub-link.active {
    box-shadow: inset 2px 0 var(--app-keskin-red);
}

#page-content-wrapper {
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

footer {
    margin-top: auto;
}

/* Yükleme katmanı */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
}

/* ================================================================
   Operasyon Tasarım Sistemi
   Saha koşulları, yüksek okunabilirlik ve tutarlı geri bildirim için.
   ================================================================ */
:root {
    /* Kabuk (üst bar + kenar menü): Matlı AI görselindeki koyu arduvaz tonları. */
    --app-chrome-950: #12161f;
    --app-chrome-900: #1b2130;
    --app-chrome-700: #3b4356;
    /* Vurgu: aynı görseldeki mor kareler. */
    --app-brand-950: #2e1a57;
    --app-brand-900: #40237a;
    --app-brand-800: #5b2bb5;
    --app-brand-700: #7a3fd9;
    --app-brand-500: #923de3;
    --app-brand-200: #ddd0f6;
    --app-brand-100: #ebe2fb;
    --app-brand-50: #f6f2fe;
    /* Keskinoğlu kırmızısı: yalnızca marka vurgusu (üst bar şeridi, etkin menü işareti). */
    --app-keskin-red: #e3141f;
    --app-heading: #1a1f2b;
    --app-egg: #fcfbff;
    --app-canvas: #f4f5f8;
    --app-amber: #b87316;
    --app-amber-soft: #fff2d6;
    --app-danger: #b4232f;
    --app-danger-soft: #fce8e9;
    --app-info: #286782;
    --app-ink: #1a1f2b;
    --app-muted: #5f6878;
    --app-border: #dfe3ea;
    --app-radius: 0.85rem;
    --app-shadow: 0 0.25rem 1.25rem rgba(18, 22, 31, 0.08);
    --topbar-height: 64px;
    --sidebar-width: 264px;
    /*
        Yazı rolleri için alt sınırlar. Kök 14/15px olduğu için rem tek başına 11px altına
        inebiliyordu; ahır ofisinde parlak ışıkta okunabilirlik için max() ile taban konur.
        meta: durum etiketleri, tablo başlıkları (büyük harf), gösterge etiketleri, künye.
        label: form etiketleri, yardım metni, bölüm alt başlıkları.
    */
    --type-meta: max(12px, 0.8rem);
    --type-label: max(13px, 0.86rem);
}

html {
    scroll-behavior: smooth;
}

body.app-shell {
    padding-top: var(--topbar-height);
    color: var(--app-ink);
    background: var(--app-canvas);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.65rem 1rem;
    color: #fff;
    background: var(--app-chrome-950);
    border-radius: 0.5rem;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.app-topbar {
    height: var(--topbar-height);
    z-index: 1040;
    color: #fff;
    background: linear-gradient(100deg, var(--app-chrome-950), var(--app-chrome-900) 60%, var(--app-chrome-700));
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--app-keskin-red), var(--app-keskin-red) 18%, var(--app-brand-500) 62%, var(--app-brand-700)) 1;
    box-shadow: 0 0.25rem 1rem rgba(18, 22, 31, 0.22);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: #fff;
    text-decoration: none;
}

.brand-mark,
.user-avatar {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.12);
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-copy strong {
    font-size: 0.98rem;
    letter-spacing: 0.01em;
}

.brand-copy small {
    margin-top: 0.18rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--type-meta);
}

.topbar-action,
.user-menu-button {
    display: inline-flex;
    align-items: center;
    min-height: 2.35rem;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.09);
}

.topbar-action:hover,
.user-menu-button:hover,
.user-menu-button:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

#sidebar {
    top: var(--topbar-height);
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    min-height: calc(100vh - var(--topbar-height));
    background: var(--app-chrome-950);
    box-shadow: inset -1px 0 rgba(255, 255, 255, 0.05);
}

#sidebar.collapsed {
    width: 68px;
    min-width: 68px;
    max-width: 68px;
}

@media (min-width: 992px) {
    /* Dar görünümde yalnızca birincil menü ikonlarını göster. Açık kalan
       alt menülerdeki nokta ikonları navigasyonu görsel olarak bozuyordu. */
    #sidebar.collapsed .sidebar-submenu {
        display: none !important;
    }

    #sidebar.collapsed .sidebar-content > .nav > .nav-item > .sidebar-link {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        min-height: 48px;
        margin: 0.25rem auto;
        padding: 0;
        color: rgba(255, 255, 255, 0.86);
        border-radius: 0.7rem;
    }

    #sidebar.collapsed .sidebar-content > .nav > .nav-item > .sidebar-link > i:first-child {
        flex: 0 0 auto;
        margin: 0 !important;
        font-size: 1.25rem;
        line-height: 1;
    }

    #sidebar.collapsed .sidebar-content > .nav > .nav-item > .sidebar-link.active {
        color: #fff;
        box-shadow: inset 0 0 0 1px rgba(176, 132, 240, 0.55);
    }

    #sidebar.collapsed .sidebar-content > .nav > .nav-item > .sidebar-link:focus-visible {
        outline: 3px solid rgba(176, 132, 240, 0.6);
        outline-offset: 1px;
    }
}

.nav-section-label {
    padding: 0.8rem 1rem 0.45rem;
    color: rgba(255, 255, 255, 0.45);
    font-size: var(--type-meta);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.sidebar-link {
    min-height: 2.7rem;
    margin: 0.12rem 0.55rem;
    padding: 0.68rem 0.75rem;
    color: rgba(255, 255, 255, 0.76);
    border-radius: 0.6rem;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
    color: #fff;
    border-left: 0;
    background: rgba(146, 61, 227, 0.24);
    box-shadow: inset 3px 0 var(--app-keskin-red);
}

.sidebar-submenu {
    margin: 0 0.55rem;
    background: rgba(0, 0, 0, 0.12);
    border-radius: 0.65rem;
}

.sidebar-sub-link {
    min-height: 2.25rem;
    margin-left: 0.2rem;
    margin-right: 0.2rem;
}

#page-content-wrapper {
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--topbar-height));
}

#sidebar.collapsed ~ #page-content-wrapper {
    margin-left: 68px;
}

.app-content {
    width: 100%;
    max-width: 1680px;
    padding: 1.5rem clamp(1rem, 2.2vw, 2.25rem) 2.5rem;
}

.app-footer {
    border-top: 1px solid var(--app-border);
    background: rgba(255, 255, 255, 0.65);
}

.page-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* Başlık bloğu hiçbir zaman sağdaki eylemler/açıklamalar tarafından ezilmez;
   yer kalmazsa sağ blok alt satıra iner. Dar ekranda başlık zaten sütun düzenindedir. */
@media (min-width: 992px) {
    .page-heading > :first-child:not(:last-child) {
        flex: 1 1 22rem;
    }
}

/* Sürü detayındaki "Önerilen sonraki adım" kartının etiketi. */
.next-action-label {
    margin-bottom: 0.2rem;
    color: var(--app-label);
    font-size: var(--type-label);
    font-weight: 600;
}

.page-title {
    margin: 0;
    color: var(--app-heading);
    font-size: clamp(1.45rem, 2vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.025em;
}

.page-subtitle {
    max-width: 66rem;
    margin: 0.35rem 0 0;
    color: var(--app-muted);
}

/* Kayıt ve ölçüm ekranlarında aynı sol başlangıç çizgisi ve içerik ritmi. */
.record-page-form {
    width: 100%;
    max-width: 72rem;
}

.record-page-grid {
    --bs-gutter-x: 1rem;
    --bs-gutter-y: 1rem;
}

.record-page-aside {
    display: grid;
    align-content: start;
    gap: 1rem;
}

.record-page-aside > .card {
    margin-bottom: 0 !important;
}

.validation-summary-valid {
    display: none;
}

.card,
.surface-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
    box-shadow: var(--app-shadow);
}

.card-header {
    min-height: 3.25rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--app-border);
    border-radius: var(--app-radius) var(--app-radius) 0 0 !important;
    background: #fff;
}

.section-title {
    margin: 0;
    color: var(--app-heading);
    font-size: 1rem;
    font-weight: 720;
}

.section-kicker {
    color: var(--app-muted);
    font-size: var(--type-label);
}

.metric-card {
    position: relative;
    min-height: 8.8rem;
    padding: 1rem;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

/* Yalnızca bağlantı olan metrik kartları yükselir; statik özet kartları sabit kalır. */
a.metric-card:hover {
    color: inherit;
    border-color: #cdb8f2;
    box-shadow: 0 0.6rem 1.6rem rgba(18, 22, 31, 0.12);
    transform: translateY(-2px);
}

.metric-icon {
    display: inline-grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    color: var(--app-brand-800);
    border-radius: 0.7rem;
    background: var(--app-brand-50);
    font-size: 1.15rem;
}

.metric-label {
    margin-top: 0.8rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-weight: 650;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.metric-value {
    margin-top: 0.15rem;
    color: var(--app-heading);
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    font-weight: 780;
    line-height: 1.1;
}

.metric-context {
    margin-top: 0.35rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
}

.metric-card.metric-warning .metric-icon {
    color: var(--app-amber);
    background: var(--app-amber-soft);
}

.metric-card.metric-danger .metric-icon {
    color: var(--app-danger);
    background: var(--app-danger-soft);
}

.metric-card.metric-info .metric-icon {
    color: var(--app-info);
    background: #e4f1f6;
}

/* Uyarı durumu yalnızca simge rengiyle değil kenarlık, değer rengi ve metinle de anlatılır. */
.metric-card.metric-warning {
    border-color: #e6c27c;
}

.metric-card.metric-warning .metric-value {
    color: #8a5810;
}

.metric-card.metric-danger {
    border-color: #e5a3a9;
}

.metric-card.metric-danger .metric-value {
    color: #a21d2a;
}

.metric-flag {
    font-weight: 650;
}

.metric-card.metric-warning .metric-flag {
    color: #8a5810;
}

.metric-card.metric-danger .metric-flag {
    color: #a21d2a;
}

/* Veri yokken değer sıfır gibi okunmaz. */
.metric-card.metric-empty .metric-value {
    color: var(--app-muted);
    font-size: clamp(1.15rem, 1.6vw, 1.4rem);
}

/* Onay penceresi: işlemin uygulanacağı kayıt (kümes, sürü, adet) kalın bir satırda tekrarlanır. */
.confirm-modal-context {
    margin-bottom: 0.6rem;
    padding: 0.5rem 0.7rem;
    color: var(--app-heading);
    border-radius: 0.5rem;
    background: var(--app-neutral-soft, #eef0f4);
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.confirm-icon-warning {
    color: #8a5810;
}

/* Ana sayfa: göstergeleri daraltma paneli varsayılan olarak kapalıdır, iş kuyruğu yukarıda kalır. */
.dashboard-filter > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
}

.dashboard-filter > summary::-webkit-details-marker {
    display: none;
}

.dashboard-filter-chevron {
    color: var(--app-muted);
    transition: transform 160ms ease;
}

.dashboard-filter[open] .dashboard-filter-chevron {
    transform: rotate(180deg);
}

/* Eksik veri grubu: kuyrukta tek kalem; kümes listesi açılır. */
.action-item-group {
    align-items: center;
}

.action-item-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.missing-house-list {
    margin-top: 0.4rem;
    font-size: var(--type-label);
}

.missing-house-list > summary {
    color: var(--app-brand-800);
    cursor: pointer;
}

.missing-house-list > p {
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

/* Kuyruğun altındaki bağlam satırı: kümes durumu ve yaklaşan hareketler. */
.dashboard-context {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
}

.dashboard-context > a {
    display: grid;
    gap: 0.1rem;
    padding: 0.85rem 1rem;
    color: inherit;
    text-decoration: none;
}

.dashboard-context > a + a {
    border-left: 1px solid var(--app-border);
}

.dashboard-context > a:hover {
    background: var(--app-brand-50);
}

.dashboard-context-label {
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-weight: 650;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.dashboard-context strong {
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

.dashboard-context .text-muted {
    font-size: var(--type-meta);
}

/* Kapasite şeridi: canlı / kapasite, doluluk çubuğu ve boş yer. */
.dashboard-capacity-of {
    color: var(--app-muted);
    font-size: max(12px, 0.85rem);
    font-weight: 600;
}

.dashboard-capacity-bar {
    height: 0.4rem;
    margin: 0.3rem 0 0.15rem;
}

@media (max-width: 575.98px) {
    .dashboard-context > a + a {
        border-top: 1px solid var(--app-border);
        border-left: 0;
    }
}

.operational-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.75rem;
    border: 1px solid var(--app-brand-200);
    border-radius: var(--app-radius);
    background: linear-gradient(110deg, var(--app-brand-50), #fffdf7);
}

.quick-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.7rem;
    padding: 0.55rem 0.8rem;
    color: var(--app-heading);
    border: 1px solid var(--app-brand-200);
    border-radius: 0.65rem;
    background: #fff;
    font-weight: 650;
    text-decoration: none;
}

.quick-action:hover {
    color: #fff;
    border-color: var(--app-brand-800);
    background: var(--app-brand-800);
}

.filter-panel {
    padding: 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, 0.78);
}

.form-label {
    color: #364052;
    font-size: var(--type-label);
    font-weight: 650;
}

.form-control,
.form-select {
    min-height: 2.7rem;
    border-color: #cfd5df;
    border-radius: 0.6rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-brand-700);
    box-shadow: 0 0 0 0.2rem rgba(122, 63, 217, 0.16);
}

/* Buton renkleri "Standart bileşenler" bölümünde Bootstrap değişkenleriyle tanımlanır. */
.btn {
    min-height: 2.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-size: var(--type-meta);
    font-weight: 700;
}

.status-pill::before {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-good { color: #176545; background: #e5f4ed; }
.status-watch { color: #8a5810; background: var(--app-amber-soft); }
.status-critical { color: #a21d2a; background: var(--app-danger-soft); }
.status-neutral { color: #586274; background: #eef0f4; }

/* Irk standardı karşılaştırması (kümes toplu analiz): değerin altında standart ve sapma. */
.guide-sub {
    display: block;
    font-size: var(--type-meta);
    font-weight: 400;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.guide-dev { font-weight: 700; }
.guide-dev.dev-good { color: #176545; }
.guide-dev.dev-watch { color: #8a5810; }
.guide-dev.dev-critical { color: #a21d2a; }

/* İş kuyruğu: kart içinde ayrı kutular değil, ince ayırıcılı düz bir liste. */
.action-list {
    display: grid;
}

.action-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.75rem;
    padding: 0.85rem 0.5rem;
    color: inherit;
    border-radius: 0.5rem;
    background: #fff;
    text-decoration: none;
}

.action-list > .action-item + .action-item {
    border-top: 1px solid var(--app-border);
    border-radius: 0;
}

.action-item:hover {
    color: inherit;
    border-color: #c9b3f1;
    background: var(--app-brand-50);
}

.action-item-icon {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    color: var(--app-brand-800);
    border-radius: 0.55rem;
    background: var(--app-brand-100);
}

.data-freshness {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
}

.data-freshness::before {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #31946c;
    box-shadow: 0 0 0 0.2rem rgba(49, 148, 108, 0.13);
    content: "";
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
}

.empty-state-icon {
    display: inline-grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: 0.75rem;
    color: var(--app-brand-700);
    border-radius: 1rem;
    background: var(--app-brand-50);
    font-size: 1.5rem;
}

.chart-shell {
    position: relative;
    min-height: 23rem;
}

/* Planlama matrisi */
.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.matrix-scroll-region {
    border-radius: 0.7rem;
    outline: none;
}

.matrix-scroll-region:focus-visible {
    box-shadow: 0 0 0 0.25rem rgba(122, 63, 217, 0.2);
}

/*
    Planlama matrisi okunabilirlik tabanı: hücre içindeki hiçbir metin 11px'in altına inmez.
    Kök yazı boyutu 14/15px olduğu için rem tek başına yetmez; max() ile alt sınır konur.
*/
.planning-matrix-table {
    --matrix-text-min: max(11px, 0.75rem);
    table-layout: fixed;
    min-width: 1180px;
}

/* Genel tablo başlığı kuralı (0.72rem, büyük harf) matris tarihlerini 11px altına indirir. */
.table.planning-matrix-table > thead > tr > th {
    font-size: max(12px, 0.8rem);
}

.planning-matrix-table thead th:not(.matrix-house-column) {
    width: 92px;
    min-width: 92px;
    padding: 0.5rem 0.25rem;
}

.planning-matrix-table thead small {
    display: block;
    color: var(--app-muted);
    font-size: var(--matrix-text-min);
    font-weight: 500;
}

.planning-matrix-table thead .matrix-header-occupancy {
    margin-top: 0.2rem;
    color: var(--app-brand-800);
    font-size: var(--matrix-text-min);
    font-weight: 700;
    white-space: nowrap;
}

/* Bu hafta: geçmişle gelecek arasındaki çizgi. */
.table.planning-matrix-table > thead > tr > th.matrix-header-current {
    color: var(--app-brand-950);
    background: var(--app-brand-100) !important;
}

.planning-matrix-table thead th.matrix-header-current small:not(.matrix-header-occupancy) {
    color: #3d4555;
}

.planning-matrix-table .matrix-col-current {
    border-left: 2px solid var(--app-brand-800) !important;
}

.matrix-header-now {
    display: block;
    color: var(--app-brand-800);
    font-size: var(--matrix-text-min);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.planning-matrix-table .matrix-house-column {
    width: 170px;
    min-width: 170px;
}

.planning-matrix-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    color: var(--app-ink);
    border-right: 2px solid var(--app-border);
    background: #fff;
}

.planning-matrix-table thead .sticky-col {
    z-index: 4;
    background: #f5f6f9;
}

.matrix-house-column span,
.matrix-house-column small {
    display: block;
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-weight: 500;
}

.matrix-cell {
    height: 92px;
    cursor: pointer;
    outline: none;
    overflow: hidden;
}

.matrix-cell-content {
    display: grid;
    place-items: center;
    gap: 0.15rem;
    min-height: 90px;
    max-width: 100%;
    padding: 0.25rem;
    overflow: hidden;
}

/* Hücre içeriği hiçbir koşulda hücre genişliğini aşmaz. */
.matrix-cell-content > * {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.matrix-cell-content i {
    font-size: 0.9rem;
}

.planning-matrix-table .matrix-cell-content small {
    font-size: var(--matrix-text-min);
    font-weight: 700;
    line-height: 1.1;
}

.planning-matrix-table .matrix-cell-content strong {
    font-size: var(--matrix-text-min);
}

.planning-matrix-table .matrix-cell-content .matrix-cell-live-count {
    font-size: max(13px, 0.85rem);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.planning-matrix-table .matrix-cell-content .matrix-cell-forecast-live-count {
    color: inherit;
    font-size: var(--matrix-text-min);
    font-style: italic;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matrix-cell-content .matrix-cell-planned-count {
    padding: 0.02rem 0.3rem;
    color: #5f4300;
    background: #fff3c4;
    border: 1px dashed #d9a300;
    border-radius: 999px;
    white-space: nowrap;
}

/*
    Planlanan canlı sayısı ve birleştirme göstergesi aynı satırda durur.
    Böylece hücreye yeni bir satır eklenmez, dikey taşma oluşmaz.
*/
.matrix-cell-planned-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.14rem;
    max-width: 100%;
    overflow: hidden;
}

.matrix-cell-merge-badge {
    flex: 0 0 auto;
    padding: 0.02rem 0.24rem;
    color: #4c1d95;
    background: #ede9fe;
    border: 1px solid #a78bfa;
    border-radius: 999px;
    font-size: max(11px, 0.75rem) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    white-space: nowrap;
}

.matrix-cell-flock-code {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.matrix-cell-age {
    display: inline-flex !important;
    align-items: center;
    gap: 0.16rem;
    color: inherit;
    font-size: max(11px, 0.75rem) !important;
    font-weight: 700 !important;
    white-space: nowrap;
}

.matrix-cell-age i {
    font-size: max(10px, 0.68rem) !important;
}

.matrix-cell-planned-balance {
    display: inline-flex !important;
    align-items: center;
    gap: 0.2rem;
    max-width: 86px;
    padding: 0.08rem 0.32rem;
    color: #1e3a8a;
    background: #dbeafe;
    border: 1px solid #60a5fa;
    border-radius: 999px;
    font-size: max(11px, 0.75rem) !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.matrix-cell-planned-balance i {
    color: #1d4ed8;
    font-size: max(10px, 0.68rem) !important;
}

/*
    Hücre detay popup'ı: Bootstrap modal-sm tabanı 300px; bu ekranda %30 geniş (390px) kullanılır.
    Bootstrap .modal-dialog genişliğini --bs-modal-width değişkeninden okuduğu için max-width
    yerine değişken geçersiz kılınır; böylece 576px altındaki tam genişlik davranışı korunur.
*/
.modal-dialog.matrix-cell-detail-dialog {
    --bs-modal-width: 390px;
}

.matrix-hover-popup {
    position: fixed;
    z-index: 1090;
    width: min(330px, calc(100vw - 16px));
    padding: 0.7rem;
    color: #18362f;
    background: #fff;
    border: 1px solid #8fa79e;
    border-radius: 0.65rem;
    box-shadow: 0 12px 30px rgba(18, 22, 31, 0.24);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.matrix-hover-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.matrix-hover-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-bottom: 0.4rem;
    margin-bottom: 0.45rem;
    color: #123c33;
    font-size: var(--type-meta);
    font-weight: 800;
    border-bottom: 1px solid #dce7e2;
}

.matrix-hover-merge {
    display: block;
    padding: 0.3rem 0.4rem;
    margin-bottom: 0.5rem;
    color: #4c1d95;
    background: #ede9fe;
    border: 1px solid #c4b5fd;
    border-radius: 0.4rem;
    font-size: var(--type-meta);
    font-weight: 700;
    line-height: 1.3;
}

.matrix-hover-transfer {
    display: grid;
    gap: 0.18rem;
    font-size: var(--type-meta);
    line-height: 1.35;
}

.matrix-hover-transfer + .matrix-hover-transfer {
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px dashed #b8c9c2;
}

.matrix-hover-status {
    width: fit-content;
    padding: 0.08rem 0.35rem;
    color: #5f4300;
    background: #fff3c4;
    border-radius: 999px;
    font-size: var(--type-meta);
    font-weight: 800;
}

.matrix-hover-status.is-delayed {
    color: #fff;
    background: #b4232f;
}

.matrix-cell-activities {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
    min-height: 14px;
}

.matrix-activity-badge,
.matrix-activity-more {
    display: inline-flex;
    align-items: center;
    gap: 0.08rem;
    border-radius: 999px;
    padding: 0.05rem 0.28rem;
    font-size: max(11px, 0.75rem);
    font-weight: 800;
    line-height: 1.15;
}

.matrix-activity-badge i {
    font-size: max(10px, 0.68rem);
}

.activity-realized {
    color: #fff;
    background: #123c33;
}

.activity-planned {
    color: #5f4300;
    border: 1px dashed #8a6500;
    background: #fff3c4;
}

.activity-delayed {
    color: #fff;
    border: 1px solid #8f1d28;
    background: #b4232f;
}

/* Aynı kümese birleştirilen çoklu gelen transferler tek rozette toplanır. */
.activity-merged {
    color: #4c1d95;
    border: 1px solid #a78bfa;
    background: #ede9fe;
}

.activity-merged-delayed {
    color: #fff;
    border: 1px solid #6d28d9;
    background: #7c3aed;
}

.matrix-activity-more {
    color: #243f37;
    background: rgba(255, 255, 255, 0.78);
}

/*
    Hücre durum renkleri. Görsel ağırlık istisnalardadır: kümeslerin çoğunu oluşturan "Dolu"
    sakin bir yeşil tondur; boş/hazır kapasite, istisna ve bloklar öne çıkar.
    Seçici, Bootstrap'in ".table > :not(caption) > * > *" renk kuralından daha özgüldür
    (aksi halde koyu zemin üstünde metin rengi ezilir). Açıklama kutucukları (.matrix-swatch)
    aynı kuralları paylaşır, böylece açıklama ile hücre birbirinden ayrışamaz.
*/
:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-dolu {
    color: #123d2c;
    background-color: #e3f1ea;
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-dolu .matrix-cell-flock-code,
:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-dolu .matrix-cell-forecast-live-count {
    color: #2d5a47;
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-bakim {
    color: #3a4252;
    background-color: #e6e9ef;
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-hazir {
    color: #174a61;
    background-color: #e4f1f6;
    box-shadow: inset 0 0 0 2px #4f8dab;
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-istisna {
    color: #5e3b06;
    background-color: #fff2d6;
    background-image: repeating-linear-gradient(135deg, rgba(184, 115, 22, .16), rgba(184, 115, 22, .16) 5px, transparent 5px, transparent 10px);
    box-shadow: inset 0 0 0 2px #b87316;
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-operasyonel {
    color: #fff;
    background-color: #5b2bb5;
    background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.12) 5px, transparent 5px, transparent 10px);
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-planli {
    color: #3f2a05;
    background-color: #f3cf74;
    background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.22), rgba(255,255,255,.22) 5px, transparent 5px, transparent 10px);
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-bloklu {
    color: #fff;
    background-color: #a21d2a;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.1), rgba(255,255,255,.1) 4px, transparent 4px, transparent 8px);
}

/*
    Tüy dökme: durum rengini (çoğunlukla "Dolu") değiştirmez, sol kenara bilgi tonunda şerit ekler
    (Genel bakış'taki "Tüyde" ile aynı ton). Süren/bitmiş program düz, onaylı ama başlamamış program
    kesik çizgili şerittir. Şerit arka plan katmanıdır; durumun kenar çizgisi (box-shadow) korunur.
*/
:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-molting {
    background-image: linear-gradient(var(--app-info), var(--app-info));
    background-repeat: no-repeat;
    background-size: 5px 100%;
}

:is(.planning-matrix-table td, .matrix-swatch).matrix-cell-molting-planned {
    background-image: repeating-linear-gradient(180deg, var(--app-info) 0 5px, transparent 5px 9px);
}

.matrix-cell-molting-note {
    display: inline-flex !important;
    align-items: center;
    gap: 0.16rem;
    max-width: 86px;
    color: #173f50 !important;
    font-size: max(11px, 0.75rem) !important;
    font-weight: 700 !important;
    white-space: nowrap;
}

.matrix-cell-molting-planned .matrix-cell-molting-note {
    font-weight: 600 !important;
    font-style: italic;
}

.matrix-cell-molting-note i {
    font-size: max(10px, 0.68rem) !important;
}

/* Geçmiş haftalar opaklıkla değil, renk doygunluğu düşürülerek ayrılır; metin kontrastı korunur. */
.planning-matrix-table td.matrix-cell-past {
    filter: saturate(0.35);
}

.planning-matrix-table td.matrix-cell-historical-occupied {
    filter: saturate(0.15);
}

.planning-matrix-table td.matrix-cell[data-house-id]:hover {
    position: relative;
    z-index: 3;
    box-shadow: inset 0 0 0 2px var(--app-brand-950);
}

.planning-matrix-table td.matrix-cell:focus-visible {
    position: relative;
    z-index: 3;
    box-shadow: inset 0 0 0 3px var(--app-brand-800), inset 0 0 0 5px #fff;
}

.matrix-header-past {
    color: #5f6878;
    background: #eef0f4 !important;
}

.matrix-header-future {
    background: var(--app-brand-50) !important;
}

/* Matris açıklaması: tablonun hemen üstünde, durum kutucukları ve hücre işaretleri. */
.matrix-key {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem 1rem;
}

.matrix-key-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.matrix-key-title {
    color: var(--app-label);
    font-size: max(12px, 0.82rem);
    font-weight: 600;
}

.matrix-key-group li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--app-ink);
    font-size: max(12px, 0.82rem);
    white-space: nowrap;
}

.matrix-swatch {
    display: inline-block;
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1rem;
    border-radius: 0.25rem;
}

.matrix-key-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    font-size: var(--type-meta);
    font-weight: 800;
    line-height: 1.35;
}

.status-operational,
.bg-operational {
    color: #fff;
    background: #6f42c1;
    border-color: #5a32a3;
}

.status-exception {
    color: #7a4b00;
    background: #fff3cd;
    border-color: #f59e0b;
}

.status-merge {
    color: #4c1d95;
    background: #ede9fe;
    border-color: #a78bfa;
}

#matrixContextMenu {
    z-index: 1060;
    box-shadow: var(--app-shadow);
}

.matrix-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(2px);
}

/* Sürü yaşam döngüsü */
.lifecycle-track {
    display: grid;
    grid-template-columns: repeat(8, minmax(6.5rem, 1fr));
    min-width: 760px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
}

.lifecycle-scroll {
    overflow-x: auto;
}

.lifecycle-track li {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    padding: 0 0.35rem;
    color: var(--app-muted);
    text-align: center;
    font-size: var(--type-meta);
    font-weight: 650;
}

.lifecycle-track li::before {
    position: absolute;
    top: 1rem;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--app-border);
    content: "";
}

.lifecycle-track li:first-child::before {
    display: none;
}

.lifecycle-dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--app-border);
    border-radius: 50%;
    background: #fff;
}

.lifecycle-track .is-complete,
.lifecycle-track .is-current {
    color: var(--app-brand-900);
}

.lifecycle-track .is-complete::before,
.lifecycle-track .is-current::before {
    background: #69aa8c;
}

.lifecycle-track .is-complete .lifecycle-dot {
    color: #fff;
    border-color: var(--app-brand-700);
    background: var(--app-brand-700);
}

.lifecycle-track .is-current .lifecycle-dot {
    color: var(--app-brand-800);
    border-color: var(--app-brand-700);
    box-shadow: 0 0 0 0.3rem var(--app-brand-100);
}

.lifecycle-track + * {
    margin-top: 1rem;
}

.next-action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #c9ddd4;
    border-radius: var(--app-radius);
    background: linear-gradient(100deg, var(--app-brand-50), #fff);
}

.next-action-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    color: var(--app-brand-800);
    border-radius: 0.8rem;
    background: #fff;
    box-shadow: var(--app-shadow);
    font-size: 1.25rem;
}

/* Hızlı günlük saha girişi */
.entry-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 -1rem -1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--app-border);
    border-radius: 0 0 var(--app-radius) var(--app-radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -0.5rem 1rem rgba(18, 22, 31, 0.06);
    backdrop-filter: blur(8px);
}

/* Form içindeki alan grupları: kart içinde ikinci bir kart yerine başlıkla ayrılan düz gruplar. */
.entry-group {
    padding-top: 0.25rem;
}

/* Seçilen kümesin anlık bilgisi (canlı, yaş, verim): sakin vurgu yüzeyi. */
.entry-snapshot {
    padding: 0.6rem 0.75rem;
    border-radius: 0.6rem;
    background: var(--app-brand-50);
}

.entry-snapshot small {
    font-size: var(--type-meta);
}

.class-input {
    min-height: 3.15rem;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

#totalEggsInput {
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
    font-weight: 720;
    text-align: right;
}

.forecast-explain {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    color: #364052;
    border: 1px solid var(--app-brand-200);
    border-radius: 0.75rem;
    background: var(--app-brand-50);
}

.forecast-explain-icon {
    color: var(--app-brand-700);
    font-size: 1.2rem;
}

.forecast-explain p {
    margin-top: 0.2rem;
    color: var(--app-muted);
    font-size: max(12px, 0.82rem);
}

@media (max-width: 768px) {
    .entry-action-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .entry-action-bar > *,
    .entry-action-bar .btn {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .lifecycle-track {
        overflow-x: auto;
    }

    .next-action-card {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .next-action-card .btn {
        width: 100%;
    }
}

.table {
    --bs-table-hover-bg: var(--app-brand-50);
    vertical-align: middle;
}

.table thead th {
    color: #4f5869;
    border-bottom-color: #d3d8e1;
    background: #f5f6f9;
    font-size: var(--type-meta);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .brand-copy small,
    .brand-copy strong {
        display: none;
    }

    #sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
    }

    #sidebar.show {
        margin-left: 0;
    }

    .sidebar-backdrop.show {
        position: fixed;
        inset: var(--topbar-height) 0 0;
        z-index: 1025;
        display: block;
        background: rgba(10, 13, 20, 0.52);
        backdrop-filter: blur(2px);
    }

    #page-content-wrapper,
    #sidebar.collapsed ~ #page-content-wrapper {
        margin-left: 0;
    }

    .app-content {
        padding: 1rem 0.8rem 2rem;
    }

    .page-heading {
        flex-direction: column;
    }

    .page-heading > :last-child {
        width: 100%;
    }

    .page-heading .btn {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Oturum ekranı */
.auth-shell {
    min-height: 100vh;
    padding: 0;
    color: var(--app-ink);
    background: var(--app-canvas);
}

.auth-main,
.auth-grid {
    min-height: 100vh;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(22rem, 1.05fr) minmax(24rem, 0.95fr);
}

.auth-story {
    display: grid;
    place-items: center;
    padding: clamp(2rem, 6vw, 6rem);
    color: #fff;
    background:
        linear-gradient(145deg, rgba(18, 22, 31, 0.35), rgba(18, 22, 31, 0.1)),
        url("../images/brand/auth-background.jpg") center / cover no-repeat,
        var(--app-chrome-950);
}

.auth-story-content {
    max-width: 38rem;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 3rem;
    font-weight: 750;
}

.auth-story h1 {
    max-width: 34rem;
    margin-bottom: 1.25rem;
    font-size: clamp(2.3rem, 5vw, 4.6rem);
    font-weight: 780;
    letter-spacing: -0.055em;
    line-height: 1.02;
}

.auth-story p {
    max-width: 34rem;
    color: rgba(255, 255, 255, 0.74);
    font-size: 1.05rem;
}

.auth-points {
    display: grid;
    gap: 0.65rem;
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.88);
}

.auth-points i {
    margin-right: 0.45rem;
    color: #c4a5f3;
}

.auth-form-panel {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.auth-card {
    width: min(100%, 28rem);
}

@media (max-width: 860px) {
    .auth-grid {
        grid-template-columns: 1fr;
    }

    .auth-story {
        min-height: 16rem;
        padding: 2rem;
    }

    .auth-story h1 {
        font-size: 2.25rem;
    }

    .auth-brand {
        margin-bottom: 1.5rem;
    }

    .auth-points {
        display: none;
    }

    .auth-form-panel {
        padding: 2.5rem 1rem;
    }
}

/* ================================================================
   Responsive safety layer
   Mobile, tablet, zoomed desktop and wide-screen layouts share the
   same predictable overflow and touch behaviour.
   ================================================================ */
/*
    Yatay taşma "clip" ile kesilir. "hidden" body'yi hiç kaymayan bir kaydırma kabına
    çevirir ve position: sticky öğeleri (Kaydet çubuğu, yapışkan başlıklar) devre dışı bırakır.
*/
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

body.app-shell {
    min-height: 100dvh;
}

#wrapper,
#page-content-wrapper,
#main-content,
.app-content,
.row > *,
.card,
.card-body,
.card-header,
.modal-content,
.dropdown-menu {
    min-width: 0;
}

.app-content {
    margin-inline: auto;
}

img,
picture,
video,
canvas,
svg {
    max-width: 100%;
}

pre,
code,
.alert,
.card-body,
dd {
    overflow-wrap: anywhere;
}

.form-control,
.form-select,
.input-group,
.btn-group {
    max-width: 100%;
}

.page-heading > *,
.card-header > *,
.next-action-card > *,
.entry-action-bar > * {
    min-width: 0;
}

.page-heading > :last-child {
    flex: 0 0 auto;
}

.page-heading > :last-child,
.card-header.d-flex,
.card-body > .d-flex,
.modal-footer,
.operational-strip {
    flex-wrap: wrap;
}

.action-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.table-responsive,
.matrix-scroll-region,
.lifecycle-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.table-responsive:focus-visible {
    border-radius: 0.45rem;
    outline: 3px solid rgba(122, 63, 217, 0.24);
    outline-offset: 2px;
}

.table-responsive > .table {
    margin-bottom: 0;
}

.table-responsive > .table.table-layout-wide {
    min-width: 48rem;
}

.toast-container {
    width: min(100%, 26rem);
    max-width: calc(100vw - 1rem);
}

.chart-shell {
    width: 100%;
    min-height: clamp(16rem, 42vw, 23rem);
}

.app-footer .container-fluid > .d-flex {
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
}

@media (max-width: 991.98px) {
    .btn {
        min-inline-size: 44px;
    }

    .btn,
    .form-control,
    .form-select {
        min-height: 44px;
    }

    #sidebar,
    #sidebar.collapsed {
        width: min(86vw, var(--sidebar-width));
        min-width: min(86vw, var(--sidebar-width));
        max-width: min(86vw, var(--sidebar-width));
        margin-left: 0;
        transform: translateX(-100%);
    }

    #sidebar.show {
        margin-left: 0;
        transform: translateX(0);
    }

    #sidebar.collapsed .link-text {
        display: initial;
    }

    #sidebar.collapsed .sidebar-link {
        justify-content: flex-start;
        padding: 0.68rem 0.75rem;
        text-align: left;
    }

    #sidebar.collapsed .sidebar-link i {
        margin-right: 0.5rem !important;
        font-size: inherit;
    }

    .sidebar-backdrop.show {
        position: fixed;
        inset: var(--topbar-height) 0 0;
        z-index: 1025;
        display: block;
        background: rgba(10, 13, 20, 0.52);
        backdrop-filter: blur(2px);
    }

    #page-content-wrapper,
    #sidebar.collapsed ~ #page-content-wrapper {
        margin-left: 0;
    }

    .app-content {
        padding: 1.15rem clamp(0.8rem, 2.5vw, 1.25rem) 2rem;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading > :last-child {
        display: flex;
        flex: 1 1 auto;
        width: 100%;
        gap: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    :root {
        --topbar-height: 60px;
    }

    body.app-shell {
        padding-top: var(--topbar-height);
    }

    .app-topbar {
        height: var(--topbar-height);
        padding-inline: 0.5rem !important;
    }

    #sidebarToggle {
        min-width: 44px;
        min-height: 44px;
        margin-right: 0.45rem !important;
        padding: 0.35rem 0.65rem;
    }

    .brand-mark,
    .user-avatar {
        width: 2.1rem;
        height: 2.1rem;
    }

    .user-menu-button {
        min-width: 44px;
        min-height: 44px;
        padding: 0.25rem 0.4rem;
    }

    .user-menu-button::after {
        margin-left: 0.3rem;
    }

    .app-content {
        padding: 0.85rem 0.65rem calc(1.5rem + env(safe-area-inset-bottom));
    }

    .page-heading {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .page-heading > :last-child,
    .page-heading > :last-child > .btn-group,
    .page-heading > :last-child > form,
    .card-header > .btn-group {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .page-heading .btn,
    .page-heading form .btn,
    .card-header > .btn,
    .card-header > .btn-group .btn {
        width: 100%;
    }

    .card-header,
    .card-body,
    .filter-panel {
        padding-inline: 0.85rem;
    }

    .modal {
        --bs-modal-margin: 0.5rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-footer {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .modal-footer > *,
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }

    .input-group {
        flex-wrap: wrap;
    }

    .input-group > .form-control,
    .input-group > .form-select {
        flex: 1 1 12rem;
    }

    .input-group > .btn,
    .input-group > .input-group-text {
        flex: 0 0 auto;
    }

    .action-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .action-item > :last-child {
        grid-column: 1 / -1;
        width: 100%;
    }

    .operational-strip .quick-action {
        justify-content: center;
        flex: 1 1 100%;
    }

    .entry-action-bar {
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    }

    .app-footer {
        text-align: center;
    }

    .app-footer .container-fluid {
        padding-inline: 0.75rem !important;
    }

    .app-footer .container-fluid > .d-flex {
        justify-content: center !important;
    }

    .toast-container {
        inset: var(--topbar-height) 0 auto 0 !important;
        width: auto;
        max-width: none;
        padding: 0.5rem !important;
    }

    .auth-story {
        min-height: auto;
        padding: 1.25rem;
    }

    .auth-brand {
        margin-bottom: 0.75rem;
    }

    .auth-story h1 {
        margin-bottom: 0.75rem;
        font-size: clamp(1.65rem, 9vw, 2.15rem);
        letter-spacing: -0.04em;
    }

    .auth-story p {
        margin-bottom: 0;
        font-size: 0.92rem;
    }

    .auth-form-panel {
        padding: 1.25rem 0.75rem calc(1.5rem + env(safe-area-inset-bottom));
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    #sidebar {
        height: calc(100dvh - var(--topbar-height));
        min-height: 0;
    }

    .auth-story {
        display: none;
    }

    .auth-grid,
    .auth-main {
        min-height: 100dvh;
    }
}

/* Yumurta üretim matrisi */
.egg-production-matrix-table {
    /* 130px hücrelerde yer var: planlama matrisinin dar 11px tabanı yerine genel meta rolü. */
    --matrix-text-min: var(--type-meta);
    min-width: 2350px;
}

.egg-production-matrix-table thead th:not(.matrix-house-column) {
    width: 130px;
    min-width: 130px;
}

/* Kümes kolonunun hemen sağında sabit kalan dönem randımanı kolonu. */
.egg-production-matrix-table thead th.egg-matrix-period-yield-column,
.egg-production-matrix-table .egg-matrix-period-yield-column {
    left: 170px;
    width: 100px;
    min-width: 100px;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
    /* Birleşik kenarlıklar sabit kolonla kaymadığından ayırıcı gölgeyle çizilir. */
    box-shadow: inset -2px 0 0 var(--app-border);
}

.egg-production-matrix-table td.egg-matrix-period-yield-column small {
    display: block;
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-weight: 500;
}

.egg-matrix-period-yield {
    display: block;
    color: #146c43;
    font-size: 1rem;
    line-height: 1.15;
}

.egg-matrix-period-yield.is-unavailable {
    color: #6c757d;
}

.egg-production-matrix-table .matrix-cell-content {
    min-height: 136px;
    gap: .2rem;
    padding: .45rem .3rem;
}

.planning-matrix-table .egg-matrix-cell {
    min-width: 130px;
    cursor: default;
}

.egg-matrix-cell-actual { background: #eef8f0; }
.egg-matrix-cell-actual-incomplete { background: #fff8df; }
.egg-matrix-cell-forecast { background: #edf5ff; }
.egg-matrix-cell-unavailable { background: #fff0f0; color: #842029; }

.egg-production-matrix-table .matrix-cell-content .egg-matrix-total,
.egg-production-matrix-table .matrix-cell-content .egg-matrix-unavailable-label {
    display: block;
    font-size: 1rem;
    line-height: 1.15;
}

.egg-production-matrix-table .matrix-cell-content .egg-matrix-kind-label,
.egg-production-matrix-table .matrix-cell-content .egg-matrix-coverage,
.egg-production-matrix-table .matrix-cell-content .egg-matrix-actual-live,
.egg-production-matrix-table .matrix-cell-content .egg-matrix-yield,
.egg-production-matrix-table .matrix-cell-content .egg-matrix-formula,
.egg-matrix-header-total,
.egg-matrix-header-missing {
    display: block;
    font-size: var(--type-meta);
    line-height: 1.2;
}

.egg-matrix-coverage.is-incomplete,
.egg-matrix-header-missing {
    color: #a15c00;
    font-weight: 600;
}

.egg-production-matrix-table .matrix-cell-content .egg-matrix-actual-live {
    color: #496057;
}

.egg-production-matrix-table .matrix-cell-content .egg-matrix-yield {
    color: #146c43;
    font-weight: 700;
}

.egg-production-matrix-table .matrix-cell-content .egg-matrix-yield.is-unavailable {
    color: #6c757d;
    font-weight: 600;
}

.egg-production-matrix-table .matrix-cell-content .egg-matrix-formula {
    color: #315b86;
    white-space: normal;
}

.egg-matrix-header-total {
    margin-top: .2rem;
    font-weight: 700;
}

.egg-matrix-header-current { box-shadow: inset 0 -3px 0 var(--app-brand-700); }
.egg-legend-actual { background: #d1e7dd; color: #0f5132; }
.egg-legend-forecast { background: #cfe2ff; color: #084298; }
.egg-legend-incomplete { background: #fff3cd; color: #664d03; }
.egg-legend-unavailable { background: #f8d7da; color: #842029; }

/* ================================================================
   Standart bileşenler
   DESIGN.md ve Stitch "Kümes Operasyon" tasarım sistemiyle eşlenir.
   Bootstrap 5.3 değişkenleri palete bağlanır; böylece C# tarafında
   üretilen bg-* / btn-* sınıfları değiştirilmeden aynı dili konuşur.
   ================================================================ */
:root {
    --app-good: #176545;
    --app-good-soft: #e5f4ed;
    --app-watch: #8a5810;
    --app-critical: #a21d2a;
    --app-info-soft: #e4f1f6;
    --app-neutral: #586274;
    --app-neutral-soft: #eef0f4;
    --app-label: #364052;
    --app-control-border: #cfd5df;
    --app-table-head: #f6f7fa;
    --app-radius-sm: 0.5rem;
    --app-focus-ring: 0 0 0 0.2rem rgba(122, 63, 217, 0.22);

    --bs-body-font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    --bs-body-color: var(--app-ink);
    --bs-body-color-rgb: 26, 31, 43;
    --bs-secondary-color: var(--app-muted);
    --bs-border-color: var(--app-border);
    --bs-border-radius: var(--app-radius-sm);
    --bs-link-color: var(--app-brand-800);
    --bs-link-color-rgb: 91, 43, 181;
    --bs-link-hover-color: var(--app-brand-950);
    --bs-link-hover-color-rgb: 46, 26, 87;
    --bs-focus-ring-color: rgba(122, 63, 217, 0.25);

    --bs-primary: #5b2bb5;
    --bs-primary-rgb: 91, 43, 181;
    --bs-primary-text-emphasis: #40237a;
    --bs-primary-bg-subtle: #ebe2fb;
    --bs-primary-border-subtle: #cdb8f2;

    --bs-secondary: #5f6878;
    --bs-secondary-rgb: 95, 104, 120;
    --bs-secondary-text-emphasis: #3b4252;
    --bs-secondary-bg-subtle: #eef0f4;
    --bs-secondary-border-subtle: #d6dae2;

    --bs-success: #176545;
    --bs-success-rgb: 23, 101, 69;
    --bs-success-text-emphasis: #10462f;
    --bs-success-bg-subtle: #e5f4ed;
    --bs-success-border-subtle: #b9dcc9;

    --bs-danger: #b4232f;
    --bs-danger-rgb: 180, 35, 47;
    --bs-danger-text-emphasis: #7d1720;
    --bs-danger-bg-subtle: #fce8e9;
    --bs-danger-border-subtle: #f1c1c5;

    /* Amber dolgular (düğme, rozet, ilerleme) içindir; metin olarak beyaz zeminde okunmaz (2.2:1).
       .text-warning bu yüzden aşağıda Watch metin rengine bağlanır. */
    --bs-warning: #e0a526;
    --bs-warning-rgb: 224, 165, 38;
    --bs-warning-text-emphasis: #6b440b;
    --bs-warning-bg-subtle: #fff2d6;
    --bs-warning-border-subtle: #f0d39a;

    --bs-info: #286782;
    --bs-info-rgb: 40, 103, 130;
    --bs-info-text-emphasis: #1c4a5e;
    --bs-info-bg-subtle: #e4f1f6;
    --bs-info-border-subtle: #b9d9e6;

    --bs-light-rgb: 246, 247, 250;
    --bs-dark: #1a1f2b;
    --bs-dark-rgb: 26, 31, 43;
}

body {
    font-family: var(--bs-body-font-family);
}

/* --- Sayfa başlığı --- */
.page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
    color: var(--app-brand-800);
    font-size: max(12px, 0.85rem);
    font-weight: 600;
    text-decoration: none;
}

.page-back:hover,
.page-back:focus {
    color: var(--app-brand-950);
    text-decoration: underline;
}

.page-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.page-actions > form {
    margin: 0;
}

/* --- Kartlar --- */
.card-header :is(h2, h3, h4, h5, h6),
.card-header .card-title {
    margin-bottom: 0;
    color: var(--app-heading);
    font-size: 1rem;
    font-weight: 700;
}

.card-header .section-kicker {
    display: block;
    margin-top: 0.1rem;
}

.card-footer {
    padding: 0.75rem 1.1rem;
    border-top: 1px solid var(--app-border);
    background: var(--app-table-head);
}

.card-footer:last-child {
    border-radius: 0 0 var(--app-radius) var(--app-radius);
}

.card-title {
    color: var(--app-heading);
    font-weight: 700;
}

/* --- Veri tabloları --- */
.table {
    --bs-table-color: var(--app-ink);
    --bs-table-border-color: #e6e9ef;
    --bs-table-striped-bg: #f9fafc;
    --bs-table-hover-bg: var(--app-brand-50);
    --bs-table-active-bg: var(--app-brand-100);
    font-variant-numeric: tabular-nums;
}

.table > :not(caption) > * > * {
    padding: 0.65rem 0.8rem;
}

.table-sm > :not(caption) > * > * {
    padding: 0.4rem 0.55rem;
}

.table thead th,
.table thead.table-light th,
.table thead.table-dark th,
.table > thead > tr > th {
    color: #4f5869;
    border-bottom: 1px solid #d3d8e1;
    background: var(--app-table-head);
    font-size: var(--type-meta);
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: bottom;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.table tfoot td,
.table tfoot th,
.table .table-total {
    background: var(--app-egg);
    font-weight: 700;
}

/* Kart içinde kenara yaslanan tablo (card-body p-0). */
.card-body.p-0 > .table-responsive > .table > :not(caption) > * > :first-child,
.card > .table-responsive > .table > :not(caption) > * > :first-child,
.card-body.p-0 > .table > :not(caption) > * > :first-child {
    padding-left: 1.1rem;
}

.card-body.p-0 > .table-responsive > .table > :not(caption) > * > :last-child,
.card > .table-responsive > .table > :not(caption) > * > :last-child,
.card-body.p-0 > .table > :not(caption) > * > :last-child {
    padding-right: 1.1rem;
}

.card > .table-responsive:last-child > .table > tbody > tr:last-child > *,
.card-body.p-0 > .table-responsive > .table > tbody > tr:last-child > * {
    border-bottom: 0;
}

.card-body.p-0 > .table-responsive,
.card > .table-responsive {
    scrollbar-gutter: auto;
}

/* Tablolar kendi kaydırma alanında; hücre metni harf ortasından bölünmez. */
.table-responsive > .table :is(th, td) {
    overflow-wrap: normal;
}

.table .num,
.table td.num,
.table th.num {
    text-align: right;
    white-space: nowrap;
}

.table .table-actions,
.table td.table-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

.table-actions .btn + .btn,
.table-actions .btn + form,
.table-actions form + .btn,
.table-actions form + form {
    margin-left: 0.25rem;
}

.table-actions form {
    display: inline-block;
    margin: 0;
}

.table .empty-state {
    padding-block: 2rem;
}

/* Uyarı metni: amber dolgu rengi beyaz zeminde 2.2:1 kalır; metin Watch tonunu kullanır (7:1). */
.text-warning {
    color: #8a5810 !important;
}

/* --- Rozetler: tüm durum rozetleri yumuşak zemin + koyu metin --- */
.badge {
    padding: 0.34em 0.65em;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: max(12px, 0.74em);
    font-weight: 650;
    letter-spacing: 0.01em;
}

.badge.bg-primary,
.badge.text-bg-primary {
    color: var(--app-brand-900) !important;
    background-color: var(--app-brand-100) !important;
}

.badge.bg-success,
.badge.text-bg-success {
    color: var(--app-good) !important;
    background-color: var(--app-good-soft) !important;
}

.badge.bg-danger,
.badge.text-bg-danger {
    color: var(--app-critical) !important;
    background-color: var(--app-danger-soft) !important;
}

.badge.bg-warning,
.badge.text-bg-warning {
    color: var(--app-watch) !important;
    background-color: var(--app-amber-soft) !important;
}

.badge.bg-info,
.badge.text-bg-info {
    color: var(--app-info) !important;
    background-color: var(--app-info-soft) !important;
}

.badge.bg-secondary,
.badge.text-bg-secondary {
    color: var(--app-neutral) !important;
    background-color: var(--app-neutral-soft) !important;
}

.badge.bg-dark,
.badge.text-bg-dark {
    color: #fff !important;
    background-color: var(--app-chrome-900) !important;
}

.badge.bg-light,
.badge.text-bg-light {
    color: var(--app-label) !important;
    border-color: var(--app-border);
    background-color: #fff !important;
}

.btn .badge {
    padding: 0.2em 0.5em;
}

.status-info { color: var(--app-info); background: var(--app-info-soft); }

/* --- Butonlar --- */
.btn-sm {
    min-height: 2rem;
    border-radius: 0.45rem;
    font-size: var(--type-meta);
}

.btn-lg {
    min-height: 3rem;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--app-brand-800);
    --bs-btn-border-color: var(--app-brand-800);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-brand-950);
    --bs-btn-hover-border-color: var(--app-brand-950);
    --bs-btn-focus-shadow-rgb: 122, 63, 217;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--app-brand-950);
    --bs-btn-active-border-color: var(--app-brand-950);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #a68ad9;
    --bs-btn-disabled-border-color: #a68ad9;
}

.btn-outline-primary {
    --bs-btn-color: var(--app-brand-800);
    --bs-btn-border-color: var(--app-brand-700);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-brand-800);
    --bs-btn-hover-border-color: var(--app-brand-800);
    --bs-btn-focus-shadow-rgb: 122, 63, 217;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--app-brand-900);
    --bs-btn-active-border-color: var(--app-brand-900);
    --bs-btn-disabled-color: #a68ad9;
    --bs-btn-disabled-border-color: #cdb8f2;
}

.btn-secondary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--app-muted);
    --bs-btn-border-color: var(--app-muted);
    --bs-btn-hover-bg: #4b5466;
    --bs-btn-hover-border-color: #4b5466;
    --bs-btn-active-bg: #3b4252;
    --bs-btn-active-border-color: #3b4252;
}

.btn-outline-secondary,
.btn-light {
    --bs-btn-color: var(--app-label);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--app-control-border);
    --bs-btn-hover-color: var(--app-brand-950);
    --bs-btn-hover-bg: var(--app-brand-50);
    --bs-btn-hover-border-color: #c9b3f1;
    --bs-btn-focus-shadow-rgb: 122, 63, 217;
    --bs-btn-active-color: var(--app-brand-950);
    --bs-btn-active-bg: var(--app-brand-100);
    --bs-btn-active-border-color: #c9b3f1;
    --bs-btn-disabled-color: #9aa1ae;
    --bs-btn-disabled-bg: #fff;
    --bs-btn-disabled-border-color: var(--app-border);
}

.btn-danger {
    --bs-btn-bg: var(--app-danger);
    --bs-btn-border-color: var(--app-danger);
    --bs-btn-hover-bg: #8f1b25;
    --bs-btn-hover-border-color: #8f1b25;
    --bs-btn-active-bg: #7d1720;
    --bs-btn-active-border-color: #7d1720;
    --bs-btn-focus-shadow-rgb: 180, 35, 47;
}

.btn-outline-danger {
    --bs-btn-color: var(--app-danger);
    --bs-btn-border-color: #e3a9ae;
    --bs-btn-hover-bg: var(--app-danger);
    --bs-btn-hover-border-color: var(--app-danger);
    --bs-btn-active-bg: #8f1b25;
    --bs-btn-active-border-color: #8f1b25;
    --bs-btn-focus-shadow-rgb: 180, 35, 47;
}

.btn-warning {
    --bs-btn-color: #3d2805;
    --bs-btn-bg: #f0b843;
    --bs-btn-border-color: #e0a526;
    --bs-btn-hover-color: #3d2805;
    --bs-btn-hover-bg: #e0a526;
    --bs-btn-hover-border-color: #c98f17;
    --bs-btn-active-bg: #c98f17;
    --bs-btn-active-border-color: #c98f17;
}

.btn-outline-warning {
    --bs-btn-color: var(--app-watch);
    --bs-btn-border-color: #e4bf78;
    --bs-btn-hover-color: #3d2805;
    --bs-btn-hover-bg: #f0b843;
    --bs-btn-hover-border-color: #e0a526;
    --bs-btn-active-color: #3d2805;
    --bs-btn-active-bg: #e0a526;
    --bs-btn-active-border-color: #e0a526;
}

.btn-info {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--app-info);
    --bs-btn-border-color: var(--app-info);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #1c4a5e;
    --bs-btn-hover-border-color: #1c4a5e;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #1c4a5e;
    --bs-btn-active-border-color: #1c4a5e;
}

.btn-outline-info {
    --bs-btn-color: var(--app-info);
    --bs-btn-border-color: #9cc7d8;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-info);
    --bs-btn-hover-border-color: var(--app-info);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #1c4a5e;
    --bs-btn-active-border-color: #1c4a5e;
}

.btn-link {
    --bs-btn-color: var(--app-brand-800);
    --bs-btn-hover-color: var(--app-brand-950);
    --bs-btn-active-color: var(--app-brand-950);
}

.btn:focus-visible,
.btn-check:focus-visible + .btn {
    box-shadow: var(--app-focus-ring);
}

/* --- Formlar --- */
.form-control,
.form-select {
    border-color: var(--app-control-border);
    border-radius: var(--app-radius-sm);
}

.form-control-sm,
.form-select-sm {
    min-height: 2rem;
}

.form-text {
    color: var(--app-muted);
    font-size: var(--type-label);
}

.form-label.required::after,
.required-mark {
    margin-left: 0.15rem;
    color: var(--app-danger);
}

.form-label.required::after {
    content: "*";
}

.form-check-input:checked {
    border-color: var(--app-brand-800);
    background-color: var(--app-brand-800);
}

.form-check-input:focus {
    border-color: var(--app-brand-700);
    box-shadow: var(--app-focus-ring);
}

.form-range::-webkit-slider-thumb {
    background-color: var(--app-brand-800);
}

.form-range::-moz-range-thumb {
    background-color: var(--app-brand-800);
}

.input-group-text {
    color: var(--app-muted);
    border-color: var(--app-control-border);
    background: var(--app-table-head);
}

/* Numaralı form bölümleri (Stitch form ekranı). */
.form-section {
    padding: 1.25rem 1.1rem;
}

.form-section + .form-section {
    border-top: 1px solid var(--app-border);
}

.form-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.75rem;
    margin-bottom: 1rem;
}

.form-section-number {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--app-brand-800);
    border-radius: 0.45rem;
    background: var(--app-brand-50);
    font-size: var(--type-meta);
    font-weight: 700;
}

.form-section-title {
    margin: 0;
    color: var(--app-heading);
    font-size: 1.05rem;
    font-weight: 700;
}

.form-section-hint {
    margin-left: auto;
    color: var(--app-muted);
    font-size: var(--type-label);
}

/* Form altındaki yapışkan işlem çubuğu. */
.form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 -0.5rem 1rem rgba(18, 22, 31, 0.06);
    backdrop-filter: blur(8px);
}

.card .form-actions {
    margin: 0;
    border-width: 1px 0 0;
    border-radius: 0 0 var(--app-radius) var(--app-radius);
}

.form-actions-hint {
    margin-right: auto;
    color: var(--app-muted);
    font-size: var(--type-meta);
}

/* --- Filtre paneli --- */
.filter-panel {
    background: #fff;
    box-shadow: var(--app-shadow);
}

.filter-panel .form-label {
    margin-bottom: 0.3rem;
    color: #4f5869;
    font-size: var(--type-label);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Çoklu kümes seçimi (_LocationFilter): onay kutulu açılır liste */
.location-multi-menu {
    width: 100%;
    min-width: 16rem;
}

.location-multi-list {
    max-height: 16rem;
    overflow-y: auto;
}

/* Kümes veri özeti: üstteki kısa özet (hub) */
.summary-hub .card-body {
    display: grid;
    gap: 0.75rem;
}

.summary-hub-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    margin: 0;
}

.summary-hub-row dt {
    color: #4f5869;
    font-size: var(--type-meta);
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.summary-hub-row dd {
    margin: 0;
}

/* Yüzde göstergenin altındaki gerçek adet satırı (ör. "800.000 yumurta · std 900.000"). */
.summary-hub-detail {
    display: block;
    margin-top: 0.15rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-variant-numeric: tabular-nums;
}

.summary-hub-guide {
    padding-top: 0.75rem;
    border-top: 1px solid var(--app-border);
}

.summary-hub-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--bs-danger-text-emphasis, #842029);
    font-size: 0.875rem;
}

.summary-hub-ok {
    color: var(--bs-success-text-emphasis, #0f5132);
    font-size: 0.875rem;
}

.filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* --- Boş durum --- */
.empty-state-title {
    margin-bottom: 0.25rem;
    color: var(--app-heading);
    font-size: 1rem;
    font-weight: 700;
}

.empty-state-message {
    max-width: 32rem;
    margin: 0 auto;
    color: var(--app-muted);
}

/* --- Uyarılar, sekmeler ve diğer Bootstrap bileşenleri --- */
.alert {
    border-radius: 0.7rem;
}

.alert > .bi:first-child {
    flex: 0 0 auto;
}

.nav-tabs {
    --bs-nav-tabs-border-color: var(--app-border);
    --bs-nav-tabs-link-hover-border-color: var(--app-border) var(--app-border) var(--app-border);
    --bs-nav-tabs-link-active-color: var(--app-brand-950);
    --bs-nav-tabs-link-active-border-color: var(--app-border) var(--app-border) #fff;
}

.nav-tabs .nav-link {
    font-weight: 600;
}

.nav-tabs .nav-link:not(.active) {
    color: var(--app-muted);
}

.nav-pills {
    --bs-nav-pills-border-radius: var(--app-radius-sm);
    --bs-nav-pills-link-active-bg: var(--app-brand-800);
}

.pagination {
    --bs-pagination-color: var(--app-brand-800);
    --bs-pagination-hover-color: var(--app-brand-950);
    --bs-pagination-hover-bg: var(--app-brand-50);
    --bs-pagination-focus-color: var(--app-brand-950);
    --bs-pagination-focus-box-shadow: var(--app-focus-ring);
    --bs-pagination-active-bg: var(--app-brand-800);
    --bs-pagination-active-border-color: var(--app-brand-800);
    --bs-pagination-border-color: var(--app-border);
}

.progress {
    --bs-progress-bar-bg: var(--app-brand-800);
    --bs-progress-bg: #e6e9ef;
}

.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--app-brand-800);
    --bs-dropdown-link-hover-bg: var(--app-brand-50);
    --bs-dropdown-border-color: var(--app-border);
    border-radius: 0.6rem;
}

.list-group {
    --bs-list-group-border-color: var(--app-border);
    --bs-list-group-active-bg: var(--app-brand-800);
    --bs-list-group-active-border-color: var(--app-brand-800);
    --bs-list-group-action-hover-bg: var(--app-brand-50);
}

.modal-content {
    border: 0;
    border-radius: var(--app-radius);
    box-shadow: 0 1rem 3rem rgba(18, 22, 31, 0.2);
}

.modal-header {
    border-bottom-color: var(--app-border);
}

.modal-header .modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-footer {
    border-top-color: var(--app-border);
}

.accordion {
    --bs-accordion-active-color: var(--app-brand-950);
    --bs-accordion-active-bg: var(--app-brand-50);
    --bs-accordion-btn-focus-box-shadow: var(--app-focus-ring);
    --bs-accordion-border-color: var(--app-border);
}

/* Açıklama listeleri (detay ekranları). */
.detail-list {
    display: grid;
    grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
    gap: 0.55rem 1.25rem;
    margin: 0;
}

.detail-list dt {
    color: var(--app-muted);
    font-size: max(12px, 0.82rem);
    font-weight: 600;
}

.detail-list dd {
    margin: 0;
    color: var(--app-ink);
    font-weight: 500;
}

@media (max-width: 575.98px) {
    .detail-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.15rem;
    }

    .detail-list dd {
        margin-bottom: 0.5rem;
    }

    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
        padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    }

    .form-actions .btn {
        width: 100%;
    }

    .form-actions-hint {
        margin: 0;
        text-align: center;
    }

    .form-section-hint {
        flex-basis: 100%;
        margin-left: 0;
    }
}

@media print {
    #sidebar,
    .app-topbar,
    .app-footer,
    .page-actions,
    .form-actions,
    .filter-panel,
    .skip-link {
        display: none !important;
    }

    body.app-shell {
        padding-top: 0;
        background: #fff;
    }

    #page-content-wrapper,
    #sidebar.collapsed ~ #page-content-wrapper {
        margin-left: 0;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }
}

/* --- Kenar menü alt bağlantıları (Stitch: nokta ikonları yerine kılavuz çizgisi) --- */
.sidebar-submenu > .nav {
    margin: 0.2rem 0 0.35rem 1.35rem;
    padding: 0.15rem 0 0.15rem 0.35rem !important;
    border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-sub-link > i:first-child {
    display: none;
}

.sidebar-sub-link {
    color: rgba(255, 255, 255, 0.7);
    white-space: normal;
}

.sidebar-sub-link.active {
    color: #fff;
    background: rgba(146, 61, 227, 0.26);
    box-shadow: inset 2px 0 var(--app-keskin-red);
}
/* --- Dinlenme politikası kısıt çubukları ve lejant --- */
:root {
    --constraint-min: var(--app-danger);
    --constraint-default: #e0a526;
    --constraint-max: #9cc7d8;
    --constraint-track: #e6e9ef;
}

.legend-swatch {
    display: inline-block;
    width: 1.4rem;
    height: 0.75rem;
    margin-right: 0.35rem;
    border-radius: 3px;
    vertical-align: middle;
}

.legend-swatch-min { background: var(--constraint-min); }
.legend-swatch-default { background: var(--constraint-default); }
.legend-swatch-max { background: var(--constraint-max); }
/* ================================================================
   Kurumsal kimlik: Keskinoğlu (ürün sahibi) ve Matlı AI (geliştirici)
   Logo renkleri değiştirilmez; koyu zeminde beyaz plaka üzerinde kullanılır.
   ================================================================ */
.brand-plate {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    height: 2.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.6rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.brand-plate img {
    display: block;
    width: auto;
    height: 1.55rem;
}

.brand-credit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
    white-space: nowrap;
}

.brand-credit img {
    display: block;
    width: auto;
    height: 1.25rem;
}

.auth-logo {
    display: block;
    width: auto;
    height: 2.75rem;
    margin-bottom: 1.75rem;
}

.auth-card.text-center .auth-logo {
    margin-inline: auto;
}

.auth-credit {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--app-border);
}

.auth-standalone {
    min-height: 100vh;
}

.print-brand {
    display: none;
}

@media (max-width: 575.98px) {
    .brand-plate {
        height: 2.15rem;
        padding: 0.3rem 0.5rem;
    }

    .brand-plate img {
        height: 1.3rem;
    }

    .app-footer .brand-credit {
        justify-content: center;
    }
}

@media print {
    .print-brand {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        color: var(--app-muted);
        border-bottom: 1px solid var(--app-border);
        font-size: var(--type-meta);
    }

    .print-brand img {
        width: auto;
        height: 1.6rem;
    }
}
.empty-state-icon.text-danger {
    background: var(--app-danger-soft);
}

/* Başarı butonları anlamsal yeşildir; birincil işlem rengi (mor) ile karışmaz. */
.btn-success {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--app-good);
    --bs-btn-border-color: var(--app-good);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #10462f;
    --bs-btn-hover-border-color: #10462f;
    --bs-btn-focus-shadow-rgb: 23, 101, 69;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #0c3826;
    --bs-btn-active-border-color: #0c3826;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #7aa892;
    --bs-btn-disabled-border-color: #7aa892;
}

.btn-outline-success {
    --bs-btn-color: var(--app-good);
    --bs-btn-border-color: #9fcab3;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-good);
    --bs-btn-hover-border-color: var(--app-good);
    --bs-btn-focus-shadow-rgb: 23, 101, 69;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #10462f;
    --bs-btn-active-border-color: #10462f;
}

/* Yumurta üretimi: Ana Plan / What-if Senaryoları geçişi */
.egg-mode-switch {
    display: inline-flex;
    gap: .25rem;
    padding: .25rem;
    margin-bottom: .75rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
}

.egg-mode-switch-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .8rem;
    border-radius: .35rem;
    color: #495057;
    font-size: .875rem;
    text-decoration: none;
}

.egg-mode-switch-link:hover,
.egg-mode-switch-link:focus-visible {
    background: #f1f3f5;
    color: #212529;
}

.egg-mode-switch-link.is-active {
    background: var(--app-brand-800);
    color: #fff;
}

/* --- Klavye odağı: açık zeminde %22 saydam halka 1,4:1 kalıyordu; opak mor çizgi eklenir --- */
:root {
    --app-focus-outline: var(--app-brand-800);
}

.btn:focus-visible,
.btn-check:focus-visible + .btn,
.page-link:focus-visible,
.form-check-input:focus-visible,
.table-responsive:focus-visible,
.matrix-scroll-region:focus-visible,
.accordion-button:focus-visible,
.nav-tabs .nav-link:focus-visible,
main a:not(.btn):focus-visible,
summary:focus-visible {
    outline: 2px solid var(--app-focus-outline);
    outline-offset: 2px;
}

/* --- Dinlenme politikası kısıt çubuğu etiketleri (12px tabanı, renkli dolgu üstünde okunur) --- */
.constraint-bar-label {
    padding: 0 0.35rem;
    color: var(--app-heading);
    font-size: var(--type-meta);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--app-border);
    border-radius: 4px;
}

.constraint-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    color: var(--app-label);
    font-size: var(--type-label);
}

/* Geri bağlantısı başlığın üstünde kendi satırında durur (başlık bloğu esnek kutuya döndüğünde de). */
.page-heading .page-back {
    flex-basis: 100%;
}
.constraint-bar-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-variant-numeric: tabular-nums;
}

/* --- Kenar menü: görev grupları, menü araması, odak göstergesi --- */
.sidebar-link {
    transition: color 0.15s ease, background-color 0.15s ease;
}

/* Grup başlıkları bağlantı değil düğmedir (sayfa değiştirmez, alt menüyü açar). */
button.sidebar-toggle {
    width: calc(100% - 1.1rem);
    text-align: left;
    background: transparent;
    border: 0;
}

/* Kapalı duran grubun içinde etkin sayfa varsa başlık bunu belli eder. */
.sidebar-toggle.has-active {
    color: #fff;
}

.sidebar-sub-link {
    font-size: max(13px, 0.87rem);
    line-height: 1.3;
}

/* Koyu zeminde Bootstrap'in mavi halkası 1,3:1 kalıyordu; opak açık mor çizgi kullanılır. */
.sidebar-link:focus-visible,
.sidebar-search-input:focus-visible {
    outline: 2px solid #b99af0;
    outline-offset: -2px;
    box-shadow: none;
}

.app-topbar .btn:focus-visible,
.app-topbar .navbar-brand:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: none;
}

.sidebar-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0.35rem 0.55rem 0.2rem;
}

.sidebar-search > .bi {
    position: absolute;
    left: 0.8rem;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.9rem;
    pointer-events: none;
}

.sidebar-search-input {
    width: 100%;
    min-height: 2.5rem;
    padding: 0 2.3rem;
    color: #fff;
    font-size: max(14px, 0.93rem);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.6rem;
}

.sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.62);
}

.sidebar-search-input::-webkit-search-cancel-button {
    display: none;
}

.sidebar-search-key {
    position: absolute;
    right: 0.6rem;
    padding: 0 0.4rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: var(--type-meta);
    line-height: 1.5;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0.3rem;
    pointer-events: none;
}

.sidebar-search-input:focus ~ .sidebar-search-key {
    display: none;
}

.sidebar-search-empty {
    margin: 0.7rem 1rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: var(--type-label);
}

.sidebar-search-empty[hidden] {
    display: none;
}

@media (min-width: 992px) {
    #sidebar.collapsed .sidebar-content > .nav > .nav-item > .sidebar-toggle.has-active {
        color: #fff;
        background: rgba(146, 61, 227, 0.24);
        box-shadow: inset 0 0 0 1px rgba(176, 132, 240, 0.55);
    }
}

/* --- Üst bar kısayolu: dar ekranda metin gizlenir, düğme kalır --- */
.topbar-action {
    gap: 0.35rem;
}

@media (max-width: 767.98px) {
    .topbar-action-text {
        display: none;
    }

    .topbar-action {
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding-inline: 0;
    }

    .topbar-action .bi {
        font-size: 1.15rem;
    }
}

/* --- Son geliştirmeler: üst çubuk simgesi ve pencere --- */
.topbar-icon-action {
    position: relative;
    justify-content: center;
    min-width: 2.35rem;
    padding-inline: 0;
}

.topbar-icon-action .bi {
    font-size: 1.05rem;
}

/* Görülmemiş güncelleme sayısı. Bootstrap'in [hidden] kuralını inline-flex ezmesin diye ayrıca gizlenir. */
.topbar-badge {
    position: absolute;
    top: -0.45rem;
    right: -0.45rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border: 2px solid var(--app-chrome-900);
    border-radius: 999px;
    background: var(--app-brand-500);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.topbar-badge[hidden] {
    display: none;
}

.release-notes-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
}

.release-notes-title .bi {
    color: var(--app-brand-800);
}

.release-notes-lead {
    margin: 0.25rem 0 0;
    color: var(--app-muted);
    font-size: var(--type-label);
}

.release-day + .release-day {
    margin-top: 1.35rem;
}

.release-day-title {
    margin: 0 0 0.6rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.release-list {
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.release-note {
    padding: 0.8rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: 0.65rem;
    background: #fff;
}

.release-note.is-unseen {
    border-color: var(--app-brand-200);
    background: var(--app-brand-50);
    box-shadow: inset 3px 0 0 var(--app-brand-700);
}

.release-note-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
}

.release-note-title {
    margin: 0;
    color: var(--app-heading);
    font-size: 1rem;
    font-weight: 700;
}

.release-note-unseen {
    display: none;
}

.release-note.is-unseen .release-note-unseen {
    display: inline;
}

.release-note-dot {
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    margin-right: 0.45rem;
    border-radius: 50%;
    background: var(--app-brand-700);
    vertical-align: 0.1em;
}

.release-note-items {
    margin: 0.45rem 0 0;
    padding-left: 1.15rem;
    color: var(--app-ink);
}

.release-note-items li + li {
    margin-top: 0.2rem;
}

.release-note-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.5rem;
    font-size: var(--type-label);
    font-weight: 600;
}

/* --- Filtre paneli: telefonda veri ilk ekranda kalsın diye kapalı açılır --- */
.filter-panel-toggle {
    display: none;
}

@media (max-width: 767.98px) {
    .filter-panel.is-collapsible > .filter-panel-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        width: 100%;
        min-height: 44px;
        padding: 0;
        color: var(--app-heading);
        font-weight: 600;
        background: transparent;
        border: 0;
    }

    .filter-panel.is-collapsible > .filter-panel-toggle .bi-chevron-down {
        transition: transform 0.2s ease;
    }

    .filter-panel.is-collapsible.is-open > .filter-panel-toggle {
        margin-bottom: 0.75rem;
    }

    .filter-panel.is-collapsible.is-open > .filter-panel-toggle .bi-chevron-down {
        transform: rotate(180deg);
    }

    .filter-panel.is-collapsible:not(.is-open) > :not(.filter-panel-toggle) {
        display: none;
    }
}

/* ================================================================
   Dokunmatik ekran (tablet, eldivenle kullanım)
   Ölçüler ekran genişliğine değil işaretçi türüne bağlıdır; yatay tutulan 1024-1280px
   tablet de masaüstü ölçülerine düşmez. Dosyanın sonunda durur ki .btn-sm gibi
   bileşen kurallarını ezsin.
   ================================================================ */
@media (pointer: coarse) {
    .btn {
        min-inline-size: 44px;
    }

    .btn,
    .btn-sm,
    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm {
        min-height: 44px;
    }

    .btn-sm {
        font-size: max(14px, 0.9rem);
    }

    .form-control,
    .form-select {
        font-size: max(16px, 1rem);
    }

    .table-actions .btn {
        display: inline-flex;
        align-items: center;
        padding-inline: 0.75rem;
    }

    .table-actions .btn + .btn,
    .table-actions .btn + form,
    .table-actions form + .btn,
    .table-actions form + form {
        margin-left: 0.5rem;
    }

    .form-check-input {
        width: 1.4em;
        height: 1.4em;
        margin-top: 0.05em;
    }

    .form-check-label {
        padding-left: 0.25rem;
    }

    .page-link {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .sidebar-link,
    .sidebar-sub-link {
        min-height: 44px;
    }
}

/* ================================================================
   "Bugün" ekranı (Views/Home): gün ve çiftlik seçimi, gösterge kartları,
   veri girişi durumu, kümes durum haritası, şirket › çiftlik › kümes ağaç tablosu.
   ================================================================ */
.today-date-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.today-date-form .form-control {
    width: 10.5rem;
}

/* Çiftlik sekmeleri ve ticari/yarka geçişi aynı bölmeli denetimi kullanır. */
.today-farm-tabs,
.today-kind-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    width: fit-content;
    max-width: 100%;
    padding: 0.25rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: #fff;
}

.today-farm-tab,
.today-kind-button {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.4rem 0.9rem;
    color: var(--app-label);
    border: 0;
    border-radius: 0.6rem;
    background: transparent;
    font-weight: 650;
    text-decoration: none;
}

.today-farm-tab:hover,
.today-kind-button:hover {
    color: var(--app-brand-900);
    background: var(--app-brand-50);
}

.today-farm-tab.active,
.today-kind-button.active {
    color: #fff;
    background: var(--app-brand-800);
}

.today-kind-count {
    margin-left: 0.4rem;
    font-size: var(--type-meta);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    opacity: 0.8;
}

/* Gösterge kartları: fark satırı ve mini eğri kartın altına hizalanır. */
.today-kpis .metric-card {
    display: flex;
    flex-direction: column;
}

.today-kpis .metric-value {
    font-variant-numeric: tabular-nums;
}

.metric-unit {
    color: var(--app-muted);
    font-size: var(--type-label);
    font-weight: 650;
}

.metric-delta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.4rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
}

.metric-delta strong {
    margin-right: 0.3rem;
    font-variant-numeric: tabular-nums;
}

/* Fark yerine gösterilen açıklama (ör. girişi eksik günde toplam kıyaslanmaz). */
.metric-note {
    margin-top: 0.4rem;
    color: var(--app-watch);
    font-size: var(--type-meta);
}

.metric-delta.delta-good strong,
.metric-delta.delta-good i {
    color: var(--app-good);
}

.metric-delta.delta-bad strong,
.metric-delta.delta-bad i {
    color: var(--app-critical);
}

.metric-spark {
    display: block;
    width: 100%;
    height: 1.75rem;
    margin-top: auto;
    padding-top: 0.6rem;
    box-sizing: content-box;
}

.metric-spark polyline {
    fill: none;
    stroke: var(--app-brand-700);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.metric-card.metric-warning .metric-spark polyline {
    stroke: var(--app-watch);
}

.metric-card.metric-danger .metric-spark polyline {
    stroke: var(--app-critical);
}

/* Canlı hayvanın çiftliklere dağılımı; her dilimin adı ve yüzdesi altındaki listede yazar. */
.share-bar {
    display: flex;
    gap: 2px;
    height: 0.45rem;
    margin-top: 0.65rem;
    overflow: hidden;
    border-radius: 999px;
}

.share-segment {
    min-width: 3px;
}

.share-0 { background: var(--app-brand-800); }
.share-1 { background: var(--app-amber); }
.share-2 { background: var(--app-info); }
.share-3 { background: var(--app-neutral); }

.share-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.7rem;
    margin: 0.45rem 0 0;
    padding: 0;
    color: var(--app-muted);
    font-size: var(--type-meta);
    list-style: none;
}

.share-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.3rem;
    border-radius: 50%;
}

/* Bugünkü veri girişi: geniş ekranda oran solda, bekleyen kümesler sağda. */
.entry-layout {
    display: grid;
    gap: 0.25rem 2rem;
}

@media (min-width: 992px) {
    .entry-layout {
        grid-template-columns: minmax(16rem, 1fr) 2fr;
        align-items: start;
    }

    .entry-layout .entry-progress {
        margin-bottom: 0;
    }
}

.entry-rate {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6rem;
}

.entry-rate strong {
    color: var(--app-heading);
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    font-variant-numeric: tabular-nums;
    font-weight: 780;
    line-height: 1.1;
}

.entry-rate span {
    color: var(--app-muted);
    font-size: var(--type-label);
}

.entry-progress {
    height: 0.55rem;
    margin: 0.7rem 0 1rem;
}

.entry-pending-title {
    margin-bottom: 0.5rem;
    color: var(--app-watch);
    font-size: var(--type-label);
    font-weight: 700;
}

.entry-pending {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.entry-pending-house {
    padding: 0.3rem 0.65rem;
    color: var(--app-watch);
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--app-amber-soft);
    font-size: var(--type-meta);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-decoration: none;
}

.entry-pending-house:hover {
    color: var(--app-watch);
    border-color: var(--app-amber);
}

.entry-pending-more summary {
    margin-top: 0.6rem;
    color: var(--app-brand-800);
    font-size: var(--type-meta);
    cursor: pointer;
}

.entry-complete {
    color: var(--app-good);
    font-weight: 650;
}

/* Kümes durum haritası: durum rengi değer metni, simge ve erişilebilir adla birlikte kullanılır. */
.house-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    margin: 0;
    padding: 0;
    color: var(--app-muted);
    font-size: var(--type-meta);
    list-style: none;
}

.house-swatch {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    margin-right: 0.35rem;
    vertical-align: -1px;
    border: 1px solid transparent;
    border-radius: 0.25rem;
}

.house-map-farm {
    margin: 1rem 0 0.5rem;
    color: var(--app-label);
    font-size: var(--type-label);
    font-weight: 700;
}

.house-map-farm:first-child {
    margin-top: 0;
}

.house-map-farm span {
    margin-left: 0.35rem;
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-weight: 500;
}

.house-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr));
    gap: 0.5rem;
}

.house-tile {
    --tile-ink: var(--app-ink);
    display: grid;
    align-content: start;
    gap: 0.1rem;
    min-height: 3.4rem;
    padding: 0.5rem 0.6rem;
    color: var(--tile-ink);
    border: 1px solid transparent;
    border-radius: 0.6rem;
    text-decoration: none;
}

.house-tile:hover,
.house-tile:focus-visible {
    color: var(--tile-ink);
    outline: 0;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--app-brand-700);
}

.house-tile-code {
    display: flex;
    justify-content: space-between;
    gap: 0.25rem;
    font-size: var(--type-meta);
    font-weight: 650;
}

.house-tile-value {
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
    font-weight: 780;
    line-height: 1.15;
}

.house-good {
    --tile-ink: #123d2c;
    border-color: #cfe8dc;
    background: var(--app-good-soft);
}

.house-watch {
    --tile-ink: #6b430a;
    border-color: #e6c27c;
    background: var(--app-amber-soft);
}

.house-critical {
    --tile-ink: #fff;
    border-color: var(--app-critical);
    background: var(--app-critical);
}

/* Tüy dökme programındaki kümes: bilgi tonu; standartla kıyaslanmaz, alarm rengi almaz. */
.house-molting {
    --tile-ink: #173f50;
    border-color: var(--app-info);
    background: #d3e8f1;
}

.house-tile-note {
    font-size: var(--type-meta);
    font-weight: 600;
    line-height: 1.2;
}

.house-nodata {
    --tile-ink: var(--app-muted);
    border: 1px dashed #9aa3b2;
    background: #fff;
}

.house-unrated {
    --tile-ink: var(--app-neutral);
    border-color: var(--app-border);
    background: var(--app-neutral-soft);
}

/* Şirket › çiftlik › kümes ağaç tablosu */
.tree-grid {
    --bs-table-bg: #fff;
    font-size: var(--type-label);
    font-variant-numeric: tabular-nums;
}

.tree-grid th,
.tree-grid td {
    padding: 0.45rem 0.55rem;
    vertical-align: middle;
    white-space: nowrap;
}

.tree-grid .status-pill {
    padding: 0.2rem 0.5rem;
}

.tree-grid .num {
    text-align: right;
}

.tree-grid tbody th,
.tree-grid thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 11.5rem;
}

.tree-grid tbody th {
    font-weight: 600;
}

.tree-grid .tree-level-1 {
    --bs-table-bg: var(--app-brand-50);
    font-weight: 700;
}

.tree-grid .tree-level-1 > th {
    font-weight: 700;
}

.tree-grid .tree-level-2 {
    --bs-table-bg: #fafafc;
    font-weight: 650;
}

.tree-row[hidden] {
    display: none;
}

.tree-row:focus-visible {
    outline: 2px solid var(--app-brand-800);
    outline-offset: -2px;
}

.tree-name {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.tree-level-2 .tree-name {
    padding-left: 1.3rem;
}

.tree-level-3 .tree-name {
    padding-left: 4.6rem;
}

.tree-toggle {
    display: inline-grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    color: var(--app-brand-800);
    border: 0;
    border-radius: 0.4rem;
    background: transparent;
}

.tree-toggle:hover {
    background: var(--app-brand-100);
}

.tree-toggle i {
    transition: transform 120ms ease;
}

.tree-row[aria-expanded="true"] .tree-toggle i {
    transform: rotate(90deg);
}

.tree-sub {
    color: var(--app-muted);
    font-size: var(--type-meta);
    font-weight: 500;
}

.tree-bad {
    color: var(--app-critical);
    font-weight: 700;
}

.tree-watch {
    color: var(--app-watch);
    font-weight: 650;
}

.tree-actions .btn-link {
    padding-inline: 0.4rem;
}

/* Çiftlik satırındaki verim çubuğu (%70–100); ince çizgi hedef verimdir. */
.yield-bar {
    position: relative;
    display: block;
    min-width: 5rem;
    height: 0.3rem;
    margin-top: 0.3rem;
    border-radius: 999px;
    background: var(--app-neutral-soft);
}

.yield-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 999px;
    background: var(--app-brand-700);
}

.yield-bar-target {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background: var(--app-amber);
}

.today-chart {
    position: relative;
    height: 16rem;
}

@media (prefers-reduced-motion: reduce) {
    .tree-toggle i {
        transition: none;
    }
}

@media (max-width: 575.98px) {
    /* Gün alanı ve "Uygula" dar ekranda da tek satırda kalır. */
    .page-heading .today-date-form {
        flex-direction: row;
        width: 100%;
    }

    .page-heading .today-date-form .form-control {
        flex: 1 1 auto;
        width: auto;
    }

    .page-heading .today-date-form .btn {
        flex: 0 0 auto;
        width: auto;
    }

    .today-farm-tabs,
    .today-kind-switch {
        width: 100%;
    }

    .house-map {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.35rem;
    }

    .house-tile {
        padding: 0.4rem 0.35rem;
    }

    .house-tile-value {
        font-size: 0.95rem;
    }

    .tree-grid tbody th,
    .tree-grid thead th:first-child {
        min-width: 9.5rem;
    }

    .tree-level-3 .tree-name {
        padding-left: 2.6rem;
    }

    .today-chart {
        height: 13rem;
    }
}
