/* قسم الأعلاف — نسخة مضغوطة */

.feed-workspace {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.875rem;
}

.feed-workspace .card {
    padding: 12px 14px;
}

.feed-workspace .card-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
}

.feed-workspace .card-header h2 {
    font-size: 0.95rem !important;
    margin: 0 0 3px;
}

.feed-workspace .card-header p {
    font-size: 0.72rem !important;
    margin: 0;
    line-height: 1.35;
}

.feed-workspace .records-header {
    flex-wrap: wrap;
    gap: 8px;
}

.feed-workspace .records-actions .btn {
    font-size: 0.75rem;
    padding: 6px 10px;
}

/* ترويسة */
.feed-hero {
    background: linear-gradient(135deg, #064e3b 0%, #059669 40%, #10b981 100%);
    border: none;
}

.feed-hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
}

.feed-hero-text h2 {
    margin: 0 0 2px;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.feed-hero-text h2 i { margin-left: 6px; }

.feed-hero-text p {
    margin: 0;
    color: rgba(255,255,255,0.88);
    font-size: 0.72rem;
}

.feed-hero-stats { display: flex; gap: 8px; flex-wrap: wrap; }

.feed-hero-stat {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
    min-width: 72px;
}

.feed-hero-stat-val {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.feed-hero-stat-lbl {
    display: block;
    font-size: 0.62rem;
    color: rgba(255,255,255,0.8);
    margin-top: 2px;
}

/* تبويبات فرعية */
.feed-subtabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.feed-subtab {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.feed-subtab i { font-size: 0.85rem; }

.feed-subtab:hover { border-color: #10b981; color: var(--text-main); }

.feed-subtab.active {
    border-color: #10b981;
    background: rgba(5,150,105,0.2);
    color: #34d399;
}

.feed-subtab[data-feed-sub="earthen"].active {
    border-color: #d97706;
    background: rgba(180,83,9,0.2);
    color: #fbbf24;
}

.feed-subtab[data-feed-sub="marine"].active {
    border-color: #14b8a6;
    background: rgba(15,118,110,0.2);
    color: #2dd4bf;
}

/* عمود واحد — عرض كامل للجدول والنموذج */
.feed-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feed-unit-banner {
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.22);
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-main);
}

.feed-unit-banner strong { color: #047857; }

body:not(.light-mode) .feed-unit-banner {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
}

body:not(.light-mode) .feed-unit-banner strong { color: #34d399; }

/* KPI مضغوطة */
.feed-kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

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

@media (max-width: 640px) {
    .feed-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.feed-kpi {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(5, 150, 105, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.2);
    min-width: 0;
}

.feed-kpi i { font-size: 0.9rem; color: #059669; width: 18px; text-align: center; flex-shrink: 0; }
.feed-kpi strong { display: block; font-size: 0.88rem; color: var(--text-main); line-height: 1.2; }
.feed-kpi span { display: block; font-size: 0.62rem; color: var(--text-muted); line-height: 1.2; }

.feed-kpi-highlight {
    border-color: #10b981;
    background: rgba(5, 150, 105, 0.14);
}
.feed-kpi-highlight i { color: #059669; }
.feed-kpi-highlight strong { color: #047857; }

body:not(.light-mode) .feed-kpi {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.28);
}
body:not(.light-mode) .feed-kpi-highlight {
    background: rgba(16, 185, 129, 0.18);
}
body:not(.light-mode) .feed-kpi-highlight strong { color: #6ee7b7; }

/* نموذج مضغوط */
.feed-workspace .feed-form .form-row {
    gap: 8px;
    margin-bottom: 8px;
}

.feed-workspace .feed-form .form-group {
    margin-bottom: 0;
    min-width: 0;
}

.feed-workspace .feed-form label {
    font-size: 0.72rem;
    margin-bottom: 3px;
}

.feed-workspace .feed-form input,
.feed-workspace .feed-form select {
    font-size: 0.8rem;
    padding: 6px 8px;
    min-height: 32px;
}

.feed-workspace .feed-form .perm-check {
    font-size: 0.72rem;
    margin-bottom: 8px !important;
}

.feed-workspace .feed-save-btn {
    font-size: 0.8rem;
    padding: 8px 14px;
}

.feed-calc-panel {
    background: rgba(5, 150, 105, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.feed-calc-panel h4 {
    margin: 0 0 8px;
    font-size: 0.78rem;
    color: #047857;
}

body:not(.light-mode) .feed-calc-panel {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.22);
}

body:not(.light-mode) .feed-calc-panel h4 { color: #34d399; }

.feed-hint { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

.feed-readonly-field {
    background: rgba(148, 163, 184, 0.08) !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
    color: var(--text-primary);
    cursor: default;
}

body.light-mode .feed-readonly-field {
    background: #f1f5f9 !important;
}

.feed-variance-box {
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.feed-variance-box.variance-ok { background: var(--safe-bg); border: 1px solid var(--safe-border); color: var(--safe-text); }
.feed-variance-box.variance-warn { background: var(--caution-bg); border: 1px solid var(--caution-border); color: var(--caution-text); }
.feed-variance-box.variance-high { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); }

.feed-save-btn { background: linear-gradient(135deg, #059669 0%, #10b981 100%) !important; border: none !important; }

.feed-workspace:not([data-active-sub="larvae"]) .feed-larvae-only { display: none !important; }
.feed-workspace[data-active-sub="larvae"] .feed-fish-stock-fields { display: none !important; }
.feed-workspace[data-active-sub="larvae"] #feedKpiBiomass,
.feed-workspace[data-active-sub="larvae"] #feedKpiDensity { visibility: hidden; }

/* فلاتر */
.feed-workspace .feed-filters {
    gap: 6px;
    margin-bottom: 8px;
}

.feed-workspace .feed-filters .filter-input,
.feed-workspace .feed-filters .filter-select {
    font-size: 0.78rem;
    padding: 5px 8px;
    min-height: 30px;
}

/* جدول السجلات */
.feed-records-card .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

.feed-table {
    width: 100%;
    min-width: 620px;
    table-layout: fixed;
    font-size: 0.72rem;
}

.feed-table th,
.feed-table td {
    padding: 5px 4px !important;
    text-align: center;
    vertical-align: middle;
    line-height: 1.25;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feed-table th {
    font-size: 0.68rem;
    font-weight: 600;
    white-space: normal;
    line-height: 1.2;
}

.feed-table th:nth-child(1),
.feed-table td:nth-child(1) { width: 11%; }

.feed-table th:nth-child(2),
.feed-table td:nth-child(2) { width: 16%; text-align: right; }

.feed-table th:nth-child(3),
.feed-table td:nth-child(3),
.feed-table th:nth-child(4),
.feed-table td:nth-child(4),
.feed-table th:nth-child(5),
.feed-table td:nth-child(5),
.feed-table th:nth-child(6),
.feed-table td:nth-child(6),
.feed-table th:nth-child(7),
.feed-table td:nth-child(7),
.feed-table th:nth-child(8),
.feed-table td:nth-child(8) { width: 9%; }

.feed-table th:nth-child(9),
.feed-table td:nth-child(9) { width: 6%; }

.feed-table td:nth-child(2) strong {
    font-size: 0.7rem;
    font-weight: 600;
}

.feed-table .btn-sm {
    padding: 3px 6px;
    font-size: 0.68rem;
}

.feed-table .variance-ok { color: var(--safe-text); }
.feed-table .variance-warn { color: var(--caution-text); font-weight: 600; }
.feed-table .variance-high { color: var(--danger-text); font-weight: 700; }

/* دليل مضغوط — خلفية فاتحة واضحة */
.feed-guide-card .card-header h2 { font-size: 0.88rem !important; color: var(--text-main); }

.feed-guide-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 900px) {
    .feed-guide-grid { grid-template-columns: 1fr; }
}

.feed-guide-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(5, 150, 105, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.16);
}

.feed-guide-item h4 {
    margin: 0 0 6px;
    font-size: 0.75rem;
    color: #047857;
    display: flex;
    align-items: center;
    gap: 6px;
}

.feed-guide-item h4 i { color: #059669; }

.feed-guide-item ul { margin: 0; padding: 0 12px 0 0; list-style: none; }

.feed-guide-item li {
    font-size: 0.68rem;
    color: var(--text-muted);
    padding: 2px 0;
    border-bottom: 1px solid var(--divider-color);
    line-height: 1.35;
}

.feed-guide-item li strong { color: var(--text-main); font-weight: 600; }
.feed-guide-item li:last-child { border-bottom: none; }

body:not(.light-mode) .feed-guide-item {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.feed-guide-item li small { color: var(--text-muted); font-size: 0.62rem; }

.feed-guide-ref {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(8, 145, 178, 0.08);
    border: 1px solid rgba(8, 145, 178, 0.18);
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.feed-guide-item[data-guide-sub="earthen"] h4 i { color: #d97706; }

.feed-guide-item[data-guide-sub="marine"] h4 i { color: #0891b2; }

.feed-guide-item li em {
    font-style: normal;
    color: #047857;
    font-weight: 600;
}

.feed-units-hint {
    margin: 6px 0 0;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.68rem;
    line-height: 1.45;
    color: #92400e;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.feed-units-hint i { margin-left: 4px; }

body:not(.light-mode) .feed-guide-item li em { color: #6ee7b7; }

/* جدول العلف اليومي — تنسيق ورقة التسليم */
.feed-daily-card {
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

body:not(.light-mode) .feed-daily-card {
    background: var(--card-bg, #1e293b);
    border-color: rgba(148, 163, 184, 0.2);
}

.feed-daily-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 12px;
}

.feed-daily-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.feed-daily-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.feed-daily-summary span {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
}

.feed-schedule-settings {
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    background: #f8fafc;
}

.feed-schedule-settings summary {
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

.feed-schedule-settings summary i { margin-left: 6px; color: #059669; }

.feed-schedule-settings-body {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
}

.feed-daily-print-header { display: none; }

.feed-daily-table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.feed-daily-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.feed-daily-table thead th {
    background: #f1f5f9;
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 10px 8px;
    border-bottom: 2px solid #cbd5e1;
    text-align: center;
    white-space: nowrap;
}

.feed-daily-table tbody td {
    font-size: 0.78rem;
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
    vertical-align: middle;
}

.feed-daily-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

body:not(.light-mode) .feed-daily-table thead th {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

body:not(.light-mode) .feed-daily-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.35);
}

.feed-daily-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.feed-daily-table tbody tr:hover {
    background: rgba(5, 150, 105, 0.06);
}

.feed-col-pond strong {
    font-size: 0.85rem;
    color: #0f172a;
}

.feed-col-batch {
    text-align: right !important;
    min-width: 100px;
}

.feed-daily-batch-primary {
    display: block;
    font-weight: 700;
    color: #0f172a;
    font-size: 0.8rem;
}

.feed-daily-batch-secondary {
    display: block;
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 2px;
}

.feed-col-weight {
    font-weight: 600;
    color: #334155;
}

.feed-size-custom {
    margin-top: 6px;
    width: 100%;
}

.feed-size-custom.hidden { display: none !important; }

.feed-size-group select { width: 100%; }

.feed-mm-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 10px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
}

.feed-mm-badge small {
    font-size: 0.62rem;
    font-weight: 500;
    opacity: 0.8;
}

.feed-protein-val {
    color: #15803d;
    font-weight: 700;
    font-size: 0.82rem;
}

.feed-col-qty strong {
    font-size: 0.88rem;
    color: #0f172a;
}

.feed-meal-qty {
    font-weight: 700;
    margin-left: 2px;
}

.feed-meal-x {
    color: #64748b;
    font-size: 0.7rem;
    margin-right: 2px;
}

.feed-time-chips {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 4px;
    justify-content: center;
}

.feed-time-chip {
    display: inline-block;
    min-width: 42px;
    text-align: center;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: ui-monospace, monospace;
    direction: ltr;
}

.feed-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
}

.feed-status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.feed-status-badge.logged {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.feed-subtabs .feed-subtab[data-feed-sub="fingerlings"].active {
    background: linear-gradient(135deg, #047857, #10b981);
}

/* أعمدة للطباعة فقط — مخفية من واجهة البرنامج */
.feed-print-only-col,
.feed-daily-table .feed-print-only-col {
    display: none !important;
}

/* عمود الحالة — داخلي، غير معروض في الواجهة */
.feed-screen-only-col,
.feed-daily-table .feed-screen-only-col {
    display: none !important;
}

.feed-screen-only-col,
.feed-daily-table .feed-screen-only-col {
    display: none !important;
}
