/* ===== CRM Rural — Design System & Styles ===== */

:root {
    /* Colors — Dark Theme */
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2235;
    --bg-card: #1e293b;
    --bg-card-hover: #243044;
    --bg-elevated: #253145;

    /* Accent Colors */
    --accent-primary: #22c55e;
    --accent-primary-dim: rgba(34, 197, 94, 0.15);
    --accent-blue: #3b82f6;
    --accent-blue-dim: rgba(59, 130, 246, 0.15);
    --accent-amber: #f59e0b;
    --accent-amber-dim: rgba(245, 158, 11, 0.15);
    --accent-red: #ef4444;
    --accent-red-dim: rgba(239, 68, 68, 0.15);
    --accent-purple: #8b5cf6;
    --accent-purple-dim: rgba(139, 92, 246, 0.15);
    --accent-cyan: #06b6d4;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #475569;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);

    /* Gradients */
    --gradient-green: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-blue: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-amber: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-red: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --gradient-card: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

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

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-green);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: var(--shadow-glow-green);
}

.logo-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-tagline {
    font-size: 11px;
    color: var(--text-tertiary);
    display: block;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    padding: 12px 12px 8px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-primary-dim);
    color: var(--accent-primary);
}

.nav-item.active i {
    color: var(--accent-primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 14px;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-badge.pulse {
    animation: pulse 2s infinite;
}

.nav-badge-new {
    margin-left: auto;
    background: var(--gradient-purple);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-info:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-blue);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.user-role {
    font-size: 11px;
    color: var(--text-tertiary);
    display: block;
}

.user-info>i {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== Main Content ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.top-header {
    height: var(--header-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
}

.header-title h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
}

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

.weather-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.weather-widget i {
    color: var(--accent-amber);
    font-size: 16px;
}

.weather-widget span:nth-child(2) {
    font-weight: 600;
    color: var(--text-primary);
}

.weather-detail {
    font-size: 11px;
    color: var(--text-tertiary);
}

.header-actions {
    display: flex;
    gap: 4px;
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.notif-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    animation: pulse 2s infinite;
}

/* ===== Content Area ===== */
.content-area {
    padding: 24px 28px;
    max-width: 1400px;
}

/* ===== Farm Score Section ===== */
.farm-score-section {
    margin-bottom: 28px;
}

.farm-score-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 40px;
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.farm-score-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.score-ring-container {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary);
    stroke-width: 10;
}

.score-ring-fill {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transition: stroke-dashoffset 2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.5));
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    font-size: 40px;
    font-weight: 900;
    color: var(--accent-primary);
    line-height: 1;
    letter-spacing: -2px;
}

.score-label {
    font-size: 14px;
    color: var(--text-tertiary);
    display: block;
}

.score-info h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.score-trend {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.score-trend.up {
    color: var(--accent-primary);
}

.score-trend.up i {
    margin-right: 4px;
}

.score-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 500px;
}

/* Module Scores Grid */
.module-scores-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.module-score-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 16px;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.module-score-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.module-score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.module-score-header i {
    font-size: 16px;
    color: var(--text-tertiary);
}

.module-score-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -1px;
}

.module-score-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    margin-bottom: 10px;
    overflow: hidden;
}

.module-score-fill {
    height: 100%;
    width: var(--score);
    background: var(--color);
    border-radius: 2px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.module-score-name {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.module-score-status {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
}

.module-score-status.good {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.module-score-status.warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.module-score-status.danger {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ===== AI Actions Section ===== */
.ai-actions-section {
    margin-bottom: 28px;
}

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

.section-header h2 {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.section-header h2 i {
    color: var(--accent-amber);
}

.section-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-purple);
    background: var(--accent-purple-dim);
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.action-card.high-impact {
    border-left: 3px solid var(--accent-primary);
}

.action-card.medium-impact {
    border-left: 3px solid var(--accent-blue);
}

.action-rank {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 28px;
    font-weight: 900;
    color: var(--bg-tertiary);
    letter-spacing: -2px;
}

.action-tag {
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-tag i {
    font-size: 11px;
}

.action-content h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.action-content p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

.action-impact {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.impact-value {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.impact-value.positive {
    color: var(--accent-primary);
}

.impact-label {
    font-size: 11px;
    color: var(--text-tertiary);
}

.action-confidence {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.confidence-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--gradient-green);
    border-radius: 2px;
}

.action-confidence span {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.btn-action-approve {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: var(--accent-primary-dim);
    color: var(--accent-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-action-approve:hover {
    background: var(--accent-primary);
    color: white;
}

.btn-action-detail {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-action-detail:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

/* ===== Alerts Section ===== */
.alerts-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
}

.alerts-count {
    font-size: 12px;
    color: var(--text-tertiary);
}

.alerts-section .section-header h2 i {
    color: var(--accent-red);
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.alert-item:hover {
    background: var(--bg-elevated);
}

.alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.alert-item.critical .alert-icon {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.alert-item.warning .alert-icon {
    background: var(--accent-amber-dim);
    color: var(--accent-amber);
}

.alert-item.info .alert-icon {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

.alert-content h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.alert-content p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

.alert-time {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.alert-severity {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}

.alert-item.critical .alert-severity {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.alert-item.warning .alert-severity {
    background: var(--accent-amber-dim);
    color: var(--accent-amber);
}

.alert-item.info .alert-severity {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

/* ===== KPIs Section ===== */
.kpis-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
}

.kpis-section .section-header h2 i {
    color: var(--accent-blue);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.kpi-card:hover {
    background: var(--bg-elevated);
    transform: translateX(4px);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--kpi-color);
    background: color-mix(in srgb, var(--kpi-color) 12%, transparent);
    flex-shrink: 0;
}

.kpi-value {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: block;
    line-height: 1.2;
}

.kpi-label {
    font-size: 11px;
    color: var(--text-secondary);
    display: block;
}

.kpi-trend {
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.up {
    color: var(--accent-primary);
}

.kpi-trend.down {
    color: var(--accent-red);
}

.kpi-trend.neutral {
    color: var(--text-tertiary);
}

/* ===== AI Chat Section ===== */
.ai-chat-section {
    margin-bottom: 28px;
}

.ai-chat-section .section-header h2 i {
    color: var(--accent-purple);
}

.section-link {
    font-size: 12px;
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition-fast);
}

.section-link:hover {
    color: var(--text-primary);
}

.chat-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
}

.chat-messages {
    padding: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.chat-message.ai .message-avatar {
    background: var(--gradient-purple);
    color: white;
}

.chat-message.user .message-avatar {
    background: var(--gradient-blue);
    color: white;
}

.message-bubble {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.6;
}

.chat-message.ai .message-bubble {
    background: var(--bg-tertiary);
    border-top-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: var(--accent-blue-dim);
    border-top-right-radius: 4px;
    color: var(--accent-blue);
}

.briefing-items {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.briefing-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.briefing-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.chat-input-area {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border-subtle);
}

.chat-suggestions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.suggestion-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.suggestion-chip:hover {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: all var(--transition-fast);
    outline: none;
}

.chat-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-dim);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send-btn,
.chat-voice-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.chat-send-btn {
    background: var(--gradient-green);
    color: white;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow-green);
}

.chat-voice-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.chat-voice-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.chat-voice-btn.recording {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    border-color: var(--accent-red);
    animation: pulse 1s infinite;
}

/* ===== Typing indicator ===== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .module-scores-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .action-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .module-scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-cards {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .farm-score-card {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .score-description {
        max-width: 100% !important;
    }

    .content-area {
        padding: 16px;
    }

    .weather-widget {
        display: none;
    }

    .header-title h1 {
        font-size: 15px;
    }
}

/* ===== Module Pages ===== */
.module-page {
    display: none;
    animation: fadeInUp .3s ease;
}

.module-page.active {
    display: block;
}

/* Module KPIs */
.mod-kpis {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.mk {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.mk:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.mk-v {
    display: block;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -1px;
}

.mk-l {
    display: block;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* Module Tabs */
.mod-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 16px;
}

.mtab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.mtab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.mtab:hover:not(.active) {
    color: var(--text-secondary);
}

/* Module Toolbar */
.mod-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.mod-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

.mod-search i {
    color: var(--text-muted);
    font-size: 13px;
}

.mod-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.mod-btn-primary {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: var(--gradient-green);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.mod-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow-green);
}

.mod-btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.mod-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Module Tables */
.mod-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
}

.mod-table {
    width: 100%;
    border-collapse: collapse;
}

.mod-table thead {
    background: var(--bg-secondary);
}

.mod-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border-subtle);
}

.mod-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.mod-table tbody tr {
    transition: background var(--transition-fast);
    cursor: pointer;
}

.mod-table tbody tr:hover {
    background: var(--bg-tertiary);
}

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

/* Table badges */
.badge-ok {
    font-size: 11px;
    font-weight: 700;
    color: #22c55e;
    background: rgba(34, 197, 94, .1);
    padding: 3px 10px;
    border-radius: 6px;
}

.badge-warning {
    font-size: 11px;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, .1);
    padding: 3px 10px;
    border-radius: 6px;
}

.badge-bad {
    font-size: 11px;
    font-weight: 700;
    color: #ef4444;
    background: rgba(239, 68, 68, .1);
    padding: 3px 10px;
    border-radius: 6px;
}

.badge-blue {
    font-size: 11px;
    font-weight: 700;
    color: #3b82f6;
    background: rgba(59, 130, 246, .1);
    padding: 3px 10px;
    border-radius: 6px;
}

.val-income {
    color: #22c55e;
    font-weight: 700;
}

.val-expense {
    color: #ef4444;
    font-weight: 700;
}

/* Avatar in table */
.td-avatar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.av-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

/* Season cards desktop */
.mod-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.season-card-d {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 20px;
    transition: all var(--transition-fast);
}

.season-card-d:hover {
    border-color: var(--border-light);
}

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

.sc-header strong {
    font-size: 15px;
}

.chip-active {
    font-size: 11px;
    font-weight: 700;
    color: #22c55e;
    background: rgba(34, 197, 94, .1);
    padding: 4px 12px;
    border-radius: 20px;
}

.chip-planned {
    font-size: 11px;
    font-weight: 700;
    color: #3b82f6;
    background: rgba(59, 130, 246, .1);
    padding: 4px 12px;
    border-radius: 20px;
}

.sc-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sc-row {
    font-size: 12px;
    color: var(--text-secondary);
}

.sc-row span {
    color: var(--text-tertiary);
}

.sc-row b {
    color: var(--text-primary);
    margin-left: 4px;
}

.progress-d {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-bar-d {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #3b82f6);
    border-radius: 3px;
    transition: width 1s ease;
}

.progress-lbl {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
    display: block;
}

/* Paddock grid desktop */
.paddock-grid-d {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.pd-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pd-tile:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
}

.pd-tile .pd-name {
    font-size: 12px;
    font-weight: 700;
    display: block;
}

.pd-tile .pd-grass {
    font-size: 10px;
    color: var(--text-tertiary);
    display: block;
    margin: 2px 0;
}

.pd-tile .pd-area {
    font-size: 10px;
    color: var(--text-tertiary);
    display: block;
}

.pd-tile .pd-animals {
    font-size: 10px;
    color: var(--text-tertiary);
    display: block;
}

.pd-tile .pd-height {
    font-size: 18px;
    font-weight: 800;
    display: block;
    margin-top: 6px;
}

.pd-tile.s-active {
    border-color: rgba(34, 197, 94, .3);
}

.pd-tile.s-active .pd-height {
    color: #22c55e;
}

.pd-tile.s-recovering {
    border-color: rgba(59, 130, 246, .3);
}

.pd-tile.s-recovering .pd-height {
    color: #3b82f6;
}

.pd-tile.s-degraded {
    border-color: rgba(239, 68, 68, .3);
    background: rgba(239, 68, 68, .04);
}

.pd-tile.s-degraded .pd-height {
    color: #ef4444;
}

/* Finance top */
.fin-top {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.fin-box {
    border-radius: 14px;
    padding: 20px;
    border: 1px solid var(--border-subtle);
}

.fin-box.income {
    background: rgba(34, 197, 94, .04);
    border-color: rgba(34, 197, 94, .15);
}

.fin-box.expense {
    background: rgba(239, 68, 68, .04);
    border-color: rgba(239, 68, 68, .15);
}

.fin-box.balance {
    background: var(--bg-card);
}

.fin-lbl {
    font-size: 12px;
    color: var(--text-tertiary);
}

.fin-val {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 4px 0;
}

.fin-box.income .fin-val {
    color: #22c55e;
}

.fin-box.expense .fin-val {
    color: #ef4444;
}

.fin-box.balance .fin-val {
    color: var(--text-primary);
}

.fin-sub {
    font-size: 11px;
    color: var(--text-tertiary);
}

.fin-sub.warn {
    color: #f59e0b;
}

/* Weather panel */
.weather-panel {
    background: linear-gradient(135deg, rgba(59, 130, 246, .06), var(--bg-card));
    border: 1px solid rgba(59, 130, 246, .15);
    border-radius: 16px;
    padding: 24px;
}

.wp-main {
    text-align: center;
    margin-bottom: 16px;
}

.wp-temp {
    font-size: 42px;
    font-weight: 900;
    display: block;
}

.wp-desc {
    font-size: 13px;
    color: var(--text-tertiary);
}

.wp-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.wp-item {
    text-align: center;
}

.wp-item i {
    font-size: 18px;
    color: #3b82f6;
    display: block;
    margin-bottom: 6px;
}

.wp-item b {
    font-size: 16px;
    display: block;
}

.wp-item span {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Chat fullscreen */
.chat-full {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 160px);
}

.chat-messages-full {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-full .chat-input-area {
    border-top: 1px solid var(--border-subtle);
    padding: 16px 24px 24px;
}

/* Modal desktop */
.modal-overlay-d {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay-d.open {
    display: flex;
}

.modal-d {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    animation: fadeInUp .3s ease;
}

.modal-d-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-d-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-d-header button {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
}

.modal-d-header button:hover {
    background: var(--bg-tertiary);
}

.modal-d-body {
    padding: 24px;
}

.modal-d-body .form-d {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-d-body .fg {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-d-body .fg label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.modal-d-body .fg input,
.modal-d-body .fg select,
.modal-d-body .fg textarea {
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
}

.modal-d-body .fg input:focus,
.modal-d-body .fg select:focus,
.modal-d-body .fg textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-dim);
}

.modal-d-body .fg select {
    appearance: none;
}

.modal-d-body .submit-d {
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--gradient-green);
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
    transition: all var(--transition-fast);
}

.modal-d-body .submit-d:hover {
    box-shadow: var(--shadow-glow-green);
}

/* Notification Toast */
.notif-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    background: rgba(30, 41, 59, .95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    z-index: 999;
    animation: slideRight .3s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(20px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

@media(max-width:1200px) {
    .mod-kpis {
        grid-template-columns: repeat(3, 1fr)
    }

    .paddock-grid-d {
        grid-template-columns: repeat(4, 1fr)
    }

    .fin-top {
        grid-template-columns: 1fr
    }
}

@media(max-width:768px) {
    .mod-kpis {
        grid-template-columns: repeat(2, 1fr)
    }

    .paddock-grid-d {
        grid-template-columns: repeat(3, 1fr)
    }

    .mod-grid {
        grid-template-columns: 1fr
    }
}