/* ============================================================
   System-side styles — INDEPENDENT from farmer.css.
   Full copy of the former shared style.css (2026-04-18) + all
   system-specific styles below. Edit freely; changes here do
   NOT affect farmer pages.
   Used by: admin.html, alerts.html, database.html, summary.html,
            planning.html, index.html (login)
   ============================================================ */

/* ========================================
   Lulim — Design System
   ======================================== */

/* -- CSS Custom Properties -- */
:root {
    --green-primary: #1B5E20;
    --green-secondary: #10b981;
    --green-dark: #059669;
    --green-hover: #0d9668;
    --text-primary: #1a1a1a;
    --text-secondary: #333;
    --text-muted: #666;
    --bg-page: #F5F5F5;
    --bg-card: #FFFFFF;
    --bg-table-header: #F8F8F8;
    --border-light: #EEE;
    --border-medium: #DDD;
    --card-radius: 12px;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --card-padding: 30px;
    --font-family: 'Heebo', 'Inter', system-ui, -apple-system, sans-serif;
    --transition-fast: 0.2s ease;
    --focus-ring: 0 0 0 3px rgba(16, 163, 74, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    direction: rtl;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    color: var(--text-primary);
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

/* -- Focus styles (accessibility) -- */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 4px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ========================================
   Header
   ======================================== */
.header {
    background: linear-gradient(to left, #1B5E20, #10b981);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo img {
    height: 52px;
}

.header-logo-text {
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn {
    padding: 8px 20px;
    border-radius: 9999px;
    border: none;
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-btn.active {
    background-color: rgba(255,255,255,0.6);
    color: var(--text-primary);
    font-weight: 600;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-btn:not(.active) {
    background-color: transparent;
    color: #FFFFFF;
}

.nav-btn:not(.active):hover {
    background-color: rgba(255,255,255,0.15);
}

.header-left {
    display: flex;
    align-items: center;
}

/* ========================================
   Bell / Alerts — Unified
   ======================================== */
.bell-wrapper {
    position: relative;
}

.nav-bell-new,
.nav-bell {
    background: none;
    border: none;
    font-size: 20px;
    color: #6B7280;
    cursor: pointer;
    position: relative;
    padding: 8px;
}

.bell-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    font-family: var(--font-family);
}

.bell-badge.has-alerts {
    display: flex;
}

/* --- Alerts dropdown panel --- */
.alerts-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    width: 360px;
    background: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 300;
    margin-top: 8px;
    overflow: hidden;
}

.alerts-panel.open {
    display: block;
}

.alerts-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.alerts-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
    flex: 1;
    text-align: center;
}

.alerts-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #9CA3AF;
    cursor: pointer;
    padding: 4px;
}

.alerts-close:hover {
    color: #374151;
}

.alerts-mark-all {
    background: none;
    border: none;
    color: var(--green-primary);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-family);
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--transition-fast);
}

.alerts-mark-all:hover {
    background: #f0fdf4;
}

.alerts-list {
    max-height: 384px;
    overflow-y: auto;
}

.alerts-empty {
    padding: 30px 20px;
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
}

.alerts-view-all {
    display: block;
    text-align: center;
    padding: 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--green-primary);
    text-decoration: none;
    border-top: 1px solid var(--border-light);
    font-family: var(--font-family);
    transition: background var(--transition-fast);
}

.alerts-view-all:hover {
    background: #F9FAFB;
}

/* --- Alert item (shared between dropdown & page) --- */
.alert-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid #F0F0F0;
    direction: rtl;
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

.alert-item:hover {
    background: #FAFAFA;
}

.alert-item.unread {
    background: #f0fdf4;
}

.alert-item.unread .alert-title {
    font-weight: 700;
}

/* Read/unread dot */
.alert-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #D1D5DB;
}

.alert-item.unread .alert-dot {
    background: #3B82F6;
}

/* Alert content */
.alert-content {
    flex: 1;
    text-align: right;
    min-width: 0;
}

.alert-title {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 2px;
}

.alert-body {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 2px;
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
}

.alert-body-wrap {
    margin-top: 8px;
    padding: 12px 14px;
    background: #F3F4F6;
    border-radius: 10px;
    border-right: 3px solid #6366F1;
    width: 100%;
}

.alert-item.expanded {
    flex-wrap: wrap;
}

.alert-item.expanded .alert-body-wrap {
    flex-basis: 100%;
}

.alert-chevron {
    font-size: 11px;
    color: #9CA3AF;
    margin-right: 4px;
    transition: transform 0.2s;
}

.alert-time {
    font-size: 12px;
    color: #9CA3AF;
}

/* Type icon circle — filled background */
.alert-type-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.alert-type-icon.danger {
    color: #DC2626;
    background: #FEE2E2;
}

.alert-type-icon.warning {
    color: #F59E0B;
    background: #FEF3C7;
}

.alert-type-icon.info {
    color: #3B82F6;
    background: #DBEAFE;
}

.alert-type-icon.success {
    color: #1B5E20;
    background: #DCFCE7;
}

/* --- Nav Bar Layout --- */
.nav-bar {
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-agropolis-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}
.nav-agropolis-logo img {
    max-height: 36px;
    max-width: 160px;
    display: block;
    object-fit: contain;
}
.nav-right {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100%;
    padding-bottom: 0;
}
.nav-brand {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    margin-left: 32px;
    padding-bottom: 10px;
}
.nav-logo { height: 40px; }
.nav-tabs {
    display: flex;
    align-items: flex-end;
    gap: 0;
    height: 100%;
}
.nav-tab {
    padding: 0 20px 8px;
    display: flex;
    align-items: flex-end;
    font-size: 15px;
    font-weight: 500;
    color: #6B7280;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-family: 'Heebo', sans-serif;
}
.nav-tab:hover { color: #1B5E20; }
.nav-tab.active {
    color: #1B5E20;
    border-bottom-color: #1B5E20;
    font-weight: 600;
}
.nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* --- Mobile Hamburger & Menu --- */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: #1F2937;
    cursor: pointer;
    padding: 8px;
}
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
}
.mobile-overlay.open { display: block; }
.mobile-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 260px;
    height: 100%;
    background: #fff;
    z-index: 200;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.3s;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mobile-menu.open { right: 0; }
.mobile-menu-close {
    align-self: flex-start;
    background: none;
    border: none;
    font-size: 22px;
    color: #6B7280;
    cursor: pointer;
    margin-bottom: 16px;
}
.mobile-menu a {
    font-size: 16px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 8px;
    transition: background 0.15s;
}
.mobile-menu a:hover, .mobile-menu a.active {
    background: #f0fdf4;
    color: #1B5E20;
}

/* --- User Profile in Nav --- */
.nav-user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
}

.nav-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0D9488;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-family);
    flex-shrink: 0;
}

.nav-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #E5E7EB;
    background: #f3f4f6;
}

.nav-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: var(--font-family);
    white-space: nowrap;
}

/* --- User Menu Dropdown --- */
.user-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 300;
    margin-top: 8px;
    overflow: hidden;
    font-family: var(--font-family);
}

.user-menu.open {
    display: block;
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    direction: rtl;
}

.user-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0D9488;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-menu-avatar-img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #E5E7EB;
    background: #f3f4f6;
}

.user-menu-info {
    direction: rtl;
    text-align: right;
}

.user-menu-name {
    font-size: 15px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 2px;
}

.user-menu-email {
    font-size: 12px;
    color: #6B7280;
}

.user-menu-phone {
    font-size: 12px;
    color: #6B7280;
    direction: ltr;
    text-align: right;
}

.user-menu-divider {
    height: 1px;
    background: #E5E7EB;
}

.user-menu-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    background: none;
    font-family: var(--font-family);
    font-size: 14px;
    color: #EF4444;
    cursor: pointer;
    direction: rtl;
    transition: background 0.15s;
}

.user-menu-logout:hover {
    background: #FEF2F2;
}

/* ========================================
   Alerts Page
   ======================================== */
.alerts-page {
    max-width: 800px;
    margin: 32px auto;
    padding: 0 20px;
}

.alerts-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.alerts-page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alerts-page-header h1 i {
    color: #6B7280;
}

.alerts-page-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-mark-all {
    background: white;
    border: 1px solid var(--green-primary);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-family: var(--font-family);
    color: var(--green-primary);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.btn-mark-all:hover {
    background: #f0fdf4;
}

.alerts-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-chip {
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-family: var(--font-family);
    color: #6B7280;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-chip:hover {
    border-color: #D1D5DB;
}

.filter-chip.active {
    background: var(--green-primary);
    color: white;
    border-color: var(--green-primary);
}

/* Alert card — full page version */
.alert-card {
    background: white;
    border-radius: 14px;
    border: 1px solid #E5E7EB;
    padding: 18px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    direction: rtl;
    cursor: pointer;
    transition: box-shadow var(--transition-fast);
}

.alert-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.alert-card.unread {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.alert-card .alert-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #D1D5DB;
}

.alert-card.unread .alert-dot {
    background: #3B82F6;
}

.alert-card .alert-type-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

.alert-card .alert-content {
    flex: 1;
}

.alert-card .alert-title {
    font-size: 15px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 4px;
}

.alert-card .alert-body {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 4px;
    white-space: normal;
}

.alert-card .alert-time {
    font-size: 12px;
    color: #9CA3AF;
}

.alert-card.unread .alert-title {
    font-weight: 700;
}

.alerts-empty-page {
    text-align: center;
    padding: 60px 20px;
    color: #9CA3AF;
}

.alerts-empty-page i {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

/* ========================================
   Page Content
   ======================================== */
.content {
    padding: 24px 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: var(--card-padding);
    margin-bottom: 24px;
}

.card-title {
    font-size: 22px;
    font-weight: bold;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: right;
}

/* ========================================
   Metrics Row
   ======================================== */
.metrics-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.metric-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 28px 24px;
    text-align: center;
    border-top: 4px solid var(--green-primary);
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--green-primary);
    margin-bottom: 8px;
    direction: ltr;
}

.metric-label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .metrics-row {
        flex-direction: column;
        gap: 12px;
    }
    .metric-card {
        padding: 20px 16px;
    }
    .metric-value {
        font-size: 28px;
    }
    .metric-label {
        font-size: 13px;
    }
}

/* ========================================
   Loading States — logo-only, no spinner/text
   ======================================== */
#loading,
.loading,
.loading-state {
    text-align: center;
    padding: 40px 20px;
    font-size: 0;
    line-height: 0;
    color: transparent;
}

#loading::before,
.loading::before,
.loading-state::before {
    content: '';
    display: block;
    width: 200px;
    height: 80px;
    margin: 0 auto;
    background: url('../images/agropulse-logo.png') no-repeat center / contain;
    animation: brandFloat 3.2s ease-in-out infinite;
    filter: drop-shadow(0 4px 14px rgba(16, 94, 32, 0.12));
}

.loading-state .spinner,
.loading .spinner,
.loading-state br,
.loading br,
#loading br {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes brandFloat {
    0%   { transform: translateY(0)    scale(1)    rotate(0deg); }
    25%  { transform: translateY(-4px) scale(1.03) rotate(-1deg); }
    50%  { transform: translateY(0)    scale(1.05) rotate(0deg); }
    75%  { transform: translateY(-4px) scale(1.03) rotate(1deg); }
    100% { transform: translateY(0)    scale(1)    rotate(0deg); }
}

.loading-error {
    color: #DC2626;
    text-align: center;
    padding: 20px;
    font-size: 14px;
}

/* ========================================
   Tables
   ======================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    direction: ltr;
}

.data-table caption {
    text-align: right;
    font-size: 0;
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.data-table thead th {
    background-color: var(--bg-table-header);
    color: #444;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 16px;
    text-align: center;
    border-bottom: 2px solid var(--border-light);
}

.data-table tbody td:first-child {
    font-weight: 700;
    color: #888;
}

.data-table tbody td {
    padding: 12px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 1px solid #F0F0F0;
}

.data-table tbody tr:hover {
    background-color: #f0fdf4;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   Action Buttons
   ======================================== */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 30px;
}

.export-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: var(--green-primary);
    color: white;
    font-size: 16px;
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition-fast);
}

.export-btn:hover {
    background: var(--green-dark);
}

.action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background: var(--green-secondary);
    color: white;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition-fast);
}

.action-btn:hover {
    background: var(--green-dark);
}

/* ========================================
   Filter Bar (reports page)
   ======================================== */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 13px;
    font-family: var(--font-family);
    cursor: pointer;
    color: #555;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    border-color: var(--green-secondary);
    color: var(--green-secondary);
}

.filter-btn[aria-expanded="true"] {
    border-color: var(--green-secondary);
    color: var(--green-secondary);
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 12px;
    min-width: 180px;
    margin-top: 4px;
}

.filter-dropdown-content.open {
    display: block;
}

.filter-dropdown-content label {
    display: block;
    margin: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.filter-dropdown-content input[type="checkbox"] {
    margin-left: 6px;
}

.filter-dropdown-content input[type="date"] {
    padding: 6px 8px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
    margin-top: 4px;
}

.filter-clear {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #DC2626;
    color: white;
    font-size: 13px;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.filter-clear:hover {
    background: #B91C1C;
}

.export-filter-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--green-primary);
    color: white;
    font-size: 13px;
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition-fast);
}

.export-filter-btn:hover {
    background: var(--green-dark);
}


/* ========================================
   Login Page
   ======================================== */
.login-body {
    background: url('../images/back.jpeg') no-repeat center center;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}

@media (max-width: 480px) {
    .login-body {
        background-image: url('../images/back-mobile.jpeg');
    }
    .login-container {
        padding: 24px 20px;
    }
}

.login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 163, 74, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--card-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.login-logo {
    margin-bottom: 30px;
}

.login-logo img {
    width: 150px;
    height: auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-form label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-secondary);
    text-align: right;
    display: block;
    margin-bottom: 4px;
}

.login-form input {
    padding: 12px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    text-align: right;
    transition: border-color var(--transition-fast);
    font-family: var(--font-family);
}

.login-form input:focus {
    outline: none;
    border-color: var(--green-secondary);
    box-shadow: var(--focus-ring);
}

.login-btn {
    padding: 12px;
    background: linear-gradient(to left, var(--green-primary), var(--green-secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    font-family: var(--font-family);
}

.login-btn:hover {
    opacity: 0.9;
}

.login-error {
    color: #DC2626;
    font-size: 14px;
    text-align: center;
}

/* ========================================
   Hamburger / Mobile Menu
   ======================================== */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 260px;
    height: 100%;
    background: linear-gradient(to bottom, var(--green-secondary), var(--green-dark));
    z-index: 200;
    padding: 20px;
    box-shadow: -4px 0 12px rgba(0,0,0,0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    visibility: hidden;
}

.mobile-menu.open {
    transform: translateX(0);
    visibility: visible;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    margin-bottom: 20px;
}

.mobile-menu .nav-btn {
    display: flex;
    width: 100%;
    margin-bottom: 8px;
    justify-content: flex-start;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 199;
}

.mobile-overlay.open {
    display: block;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .nav-bar { padding: 0 16px; position: relative; }
    .nav-hamburger { display: block; }
    .nav-tabs { display: none; }
    .nav-brand span { display: none; }
    /* Center the brand mark in the mobile nav bar. */
    .nav-brand {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        margin: 0;
        padding: 0;
        pointer-events: none;
    }
    .nav-user-name { display: none; }
    .nav-agropolis-logo img { max-height: 26px; max-width: 110px; }
    .header {
        padding: 10px 16px;
    }
    .header-nav {
        display: none;
    }
    .hamburger {
        display: block;
    }
    .content {
        padding: 12px;
    }
    .card {
        padding: 14px;
        border-radius: 8px;
        margin-bottom: 12px;
    }
    .card-title {
        font-size: 18px;
        margin-bottom: 10px;
    }
    .data-table {
        width: 100%;
    }
    .data-table thead th {
        font-size: 10px;
        font-weight: 700;
        padding: 5px 2px;
        white-space: nowrap;
        vertical-align: bottom;
    }
    .data-table tbody td {
        font-size: 10px;
        padding: 5px 2px;
        white-space: nowrap;
    }
    .data-table tbody td:first-child {
        white-space: normal;
        word-break: keep-all;
    }
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .alerts-panel {
        position: fixed;
        top: 60px;
        bottom: 20px;
        left: 5%;
        right: 5%;
        width: 90%;
        max-width: 400px;
        margin-top: 0;
        z-index: 500;
        max-height: none;
        overflow-y: auto;
    }
    .user-selector select {
        font-size: 12px;
        padding: 5px 10px;
    }
    .action-bar {
        gap: 8px;
    }
    .export-btn,
    .action-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .nav-agropolis-logo { display: none; }
}



/* ===== System-specific additions below this line ===== */
/* ===== Farm Management (admin page) ===== */

.farm-btn-add,
.farm-btn-seed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.farm-btn-add {
    background: #0D9488;
    color: #fff;
}
.farm-btn-add:hover { background: #0F766E; }

.farm-btn-seed {
    background: #F3F4F6;
    color: #374151;
    border-color: #E5E7EB;
}
.farm-btn-seed:hover { background: #E5E7EB; }
.farm-btn-seed:disabled { opacity: 0.6; cursor: not-allowed; }

.farms-table .farm-assignee-badge {
    display: inline-block;
    padding: 2px 10px;
    margin: 2px 2px 2px 0;
    background: #ECFDF5;
    color: #047857;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.farm-action-btn {
    background: transparent;
    border: 1px solid #E5E7EB;
    color: #374151;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    margin: 0 2px;
}
.farm-action-btn:hover {
    background: #F3F4F6;
    border-color: #D1D5DB;
    color: #0D9488;
}
.farm-action-btn.farm-action-danger:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #DC2626;
}

/* ===== Farm modal form ===== */
.farm-modal {
    max-width: 480px;
}
.farm-modal h3 {
    margin-bottom: 16px;
}
.farm-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.farm-form label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    gap: 4px;
}
.farm-form input,
.farm-form textarea {
    padding: 9px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Heebo', sans-serif;
    direction: rtl;
    width: 100%;
    box-sizing: border-box;
}
.farm-form input:focus,
.farm-form textarea:focus {
    outline: none;
    border-color: #0D9488;
    box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}
.farm-form input:disabled {
    background: #F9FAFB;
    color: #6B7280;
    cursor: not-allowed;
}
.farm-form textarea { resize: vertical; min-height: 60px; }

/* ===== Assign-users modal list ===== */
.farm-assign-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    user-select: none;
}
.farm-assign-row:hover { background: #F9FAFB; }
.farm-assign-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0D9488;
}
.farm-assign-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
}
.farm-assign-role {
    font-size: 11px;
    color: #9CA3AF;
    background: #F3F4F6;
    padding: 2px 8px;
    border-radius: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .farms-table thead th:nth-child(2),
    .farms-table tbody td:nth-child(2),
    .farms-table thead th:nth-child(4),
    .farms-table tbody td:nth-child(4) {
        display: none;
    }
    .farm-modal { max-width: none; }
}

/* ===== Farm extended modal (Phase 2) ===== */
.farm-modal-wide { max-width: 640px; }
.farm-form-scroll { max-height: 70vh; overflow-y: auto; padding-left: 4px; }

.farm-section {
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    margin-bottom: 10px;
    background: #F9FAFB;
    overflow: hidden;
}
.farm-section > summary {
    cursor: pointer;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}
.farm-section > summary::-webkit-details-marker { display: none; }
.farm-section > summary::before {
    content: '▼';
    font-size: 10px;
    color: #9CA3AF;
    transition: transform 0.2s;
    display: inline-block;
}
.farm-section[open] > summary::before { transform: rotate(180deg); }
.farm-section > summary i { color: #0D9488; }
.farm-section > *:not(summary) { padding: 12px 14px; }
.farm-section > label { padding: 10px 14px; padding-bottom: 4px; }
.farm-section > label + label { padding-top: 4px; }
.farm-section > .farm-grid-2 { padding: 8px 14px; }

.farm-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.farm-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-weight: 500;
    flex-direction: row;
}
.farm-checkbox-row input[type="checkbox"],
.farm-checkbox-row input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #0D9488;
    flex-shrink: 0;
}

/* ===== Buildings sub-table ===== */
.farm-buildings-empty {
    font-size: 13px;
    color: #9CA3AF;
    padding: 10px 4px;
}
.farm-buildings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 10px;
}
.farm-buildings-table thead th {
    background: #FFFFFF;
    padding: 8px 10px;
    text-align: right;
    font-weight: 600;
    color: #6B7280;
    font-size: 12px;
    border-bottom: 2px solid #E5E7EB;
}
.farm-buildings-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #F3F4F6;
}
.farm-btn-add-building {
    background: #F0FDF4;
    color: #047857;
    border: 1px dashed #86EFAC;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.farm-btn-add-building:hover { background: #DCFCE7; border-color: #22C55E; }

/* ===== Import button + modal ===== */
.farm-btn-import {
    background: #FAF5FF;
    color: #7c3aed;
    border: 1px solid #DDD6FE;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.farm-btn-import:hover { background: #F3E8FF; border-color: #A78BFA; }

#importData { font-family: monospace; font-size: 12px; }
.import-mapping-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    background: #F9FAFB;
    border-radius: 8px;
}
.import-map-row {
    display: grid;
    grid-template-columns: 1fr 20px 1fr;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
}
.import-map-src {
    font-family: monospace;
    font-size: 12px;
    color: #374151;
    background: #FFFFFF;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.import-map-arrow {
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
}
.import-map-dst {
    padding: 6px 8px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: #FFFFFF;
    font-size: 12px;
    font-family: 'Heebo', sans-serif;
}
.import-preview {
    font-family: monospace;
    font-size: 11px;
    background: #1F2937;
    color: #E5E7EB;
    padding: 10px;
    border-radius: 8px;
    max-height: 160px;
    overflow: auto;
    direction: ltr;
    text-align: left;
}
.import-summary h4 { margin: 0 0 8px; font-size: 15px; }
.import-summary > div { font-size: 13px; color: #374151; margin: 2px 0; }
.import-plan-list {
    font-size: 12px;
    margin: 8px 0;
    padding-right: 20px;
    max-height: 180px;
    overflow-y: auto;
    color: #374151;
}

/* ===== Farm sync button + aggregates panel ===== */
.farm-btn-sync {
    background: #EFF6FF;
    color: #2563EB;
    border: 1px solid #BFDBFE;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.farm-btn-sync:hover { background: #DBEAFE; border-color: #3B82F6; }
.farm-btn-sync:disabled { opacity: 0.6; cursor: not-allowed; }

.farm-live-dot {
    color: #10B981;
    font-size: 10px;
    animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.farm-aggregates-body { padding: 4px 14px 12px; }
.agg-group {
    margin-top: 10px;
    padding: 8px 10px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
}
.agg-group h5 {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.agg-group h5 i { color: #0D9488; font-size: 12px; }
.agg-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px dashed #F3F4F6;
}
.agg-row:last-child { border-bottom: none; }
.agg-label { color: #6B7280; }
.agg-val { color: #1F2937; font-weight: 600; }
.agg-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 6px;
}
.agg-badge-open { background: #DCFCE7; color: #047857; }
.agg-badge-closed { background: #F3F4F6; color: #6B7280; }

/* Narrow table columns on small screens */
@media (max-width: 900px) {
    .farms-table thead th:nth-child(2),  /* מיקום */
    .farms-table tbody td:nth-child(2),
    .farms-table thead th:nth-child(7),  /* FCR אחרון */
    .farms-table tbody td:nth-child(7) {
        display: none;
    }
}

/* ===== PoultReal one-shot import button ===== */
.farm-btn-poultreal {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Heebo', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.farm-btn-poultreal:hover { background: #FDE68A; border-color: #FBBF24; }
.farm-btn-poultreal:disabled { opacity: 0.6; cursor: not-allowed; }
