/* ========================================
   SiliTech Plantation System - Modern UI Theme
   Enhanced with gradients, animations, and glassmorphism
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Core Color Palette */
    --dark-green-main: #0B3D2E;
    --deep-forest: #145A32;
    --forest-hover: #1E8449;
    --soft-sage: #EAF4EF;
    --pure-white: #FFFFFF;
    --dark-text: #1C1C1C;
    --sub-text: #64748B;
    
    /* Accent Colors */
    --chili-red: #DC2626;
    --fresh-blue: #2563EB;
    --aqua: #06B6D4;
    --success-green: #16A34A;
    --warning-orange: #F59E0B;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0B3D2E 0%, #145A32 100%);
    --gradient-success: linear-gradient(135deg, #16A34A 0%, #22C55E 100%);
    --gradient-danger: linear-gradient(135deg, #DC2626 0%, #EF4444 100%);
    --gradient-info: linear-gradient(135deg, #0EA5E9 0%, #06B6D4 100%);
    
    /* Layout Variables */
    --sidebar-bg: var(--dark-green-main);
    --sidebar-active: var(--deep-forest);
    --sidebar-hover: rgba(255,255,255,0.1);
    --top-header-bg: var(--pure-white);
    --page-bg: #F8FAFC;
    --sidebar-border: rgba(255,255,255,0.1);
    /* Top navbar height used for sticky offsets */
    --navbar-height: 64px;
    
    /* Card & Shadow */
    --card-bg: var(--pure-white);
    --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
    --card-hover-shadow: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 12px;
    --radius-lg: 20px;
    
    /* Text */
    --text-main: var(--dark-text);
    --text-muted: var(--sub-text);
    --bg-main: var(--page-bg);
    
    /* Primary/Secondary Mapping */
    --primary-green: var(--deep-forest);
    --primary-green-rgb: 20,90,50;
    --secondary-green: var(--forest-hover);
    --danger-red: var(--chili-red);
    --danger-red-hover: #B91C1C;
    
    /* Sensor Colors */
    --sensor-temp: #EF4444;
    --sensor-temp-rgb: 239,68,68;
    --sensor-moist: #2563EB;
    --sensor-moist-rgb: 37,99,235;
    --sensor-hum: #06B6D4;
    --sensor-hum-rgb: 6,182,212;
    --sensor-ph: #16A34A;
    --sensor-ph-rgb: 22,163,74;
    
    /* Status Colors */
    --status-success: #10B981;
    --status-warning: var(--warning-orange);
    --status-danger: var(--chili-red);
    --status-info: #3B82F6;
}

/* ========================================
   BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--page-bg);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    height: 100%;
}

body {
    overflow-x: hidden;
    overflow-y: auto;
}

body.mobile-sidebar-open {
    overflow: hidden;
    touch-action: none;
}

/* Shared application splash screen */
.silitech-splash {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 42%, rgba(34, 197, 94, 0.14), transparent 23rem),
        linear-gradient(145deg, #061F18 0%, #0B3D2E 52%, #082A20 100%);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.silitech-splash.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.silitech-splash__content {
    width: min(82vw, 300px);
    text-align: center;
}

.silitech-splash__logo-wrap {
    width: clamp(128px, 30vw, 180px);
    aspect-ratio: 1;
    margin: 0 auto 1.4rem;
    display: grid;
    place-items: center;
    border: 1px solid rgba(167, 243, 208, 0.28);
    border-radius: 32%;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 12px rgba(110, 231, 183, 0.04), 0 0 42px rgba(52, 211, 153, 0.28);
    animation: silitech-logo-enter 1.1s cubic-bezier(0.2, 0.75, 0.25, 1) both, silitech-logo-glow 2.8s ease-in-out 1.1s infinite;
}

.silitech-splash__logo {
    width: 88%;
    height: 88%;
    object-fit: contain;
    animation: silitech-logo-enter 1.1s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.silitech-splash__title {
    color: #ECFDF5;
    font-size: clamp(0.9rem, 2.5vw, 1.05rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    animation: silitech-splash-copy 0.8s ease 0.35s both;
}

.silitech-splash__progress {
    height: 4px;
    margin: 1rem auto 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(236, 253, 245, 0.16);
    animation: silitech-splash-copy 0.8s ease 0.5s both;
}

.silitech-splash__progress span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #34D399, #A7F3D0);
    box-shadow: 0 0 14px rgba(110, 231, 183, 0.75);
    animation: silitech-progress 1.45s ease-in-out infinite;
}

@keyframes silitech-logo-enter {
    from { opacity: 0; transform: scale(0.78); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes silitech-logo-glow {
    0%, 100% { box-shadow: 0 0 0 12px rgba(110, 231, 183, 0.04), 0 0 42px rgba(52, 211, 153, 0.25); }
    50% { box-shadow: 0 0 0 18px rgba(110, 231, 183, 0.07), 0 0 62px rgba(52, 211, 153, 0.42); }
}

@keyframes silitech-splash-copy {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes silitech-progress {
    0% { transform: translateX(-140%); }
    100% { transform: translateX(330%); }
}

@media (prefers-reduced-motion: reduce) {
    .silitech-splash,
    .silitech-splash__logo-wrap,
    .silitech-splash__logo,
    .silitech-splash__title,
    .silitech-splash__progress,
    .silitech-splash__progress span {
        animation: none;
        transition: none;
    }
}

#wrapper {
    min-height: 100vh;
}

/* ========================================
   LAYOUT STRUCTURE
   ======================================== */

#sidebar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: linear-gradient(180deg, #0A372A 0%, #0B3D2E 100%);
    color: var(--pure-white);
    z-index: 1040;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
    white-space: nowrap;
}

#sidebar-backdrop {
    display: none;
}

#sidebar-wrapper .list-group::-webkit-scrollbar {
    width: 6px;
}

#sidebar-wrapper .list-group::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

#sidebar-wrapper .list-group::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}

/* Main column: fixed sidebar does not consume flex space, so width must account for margin-left
   or the column spans the full viewport and the sidebar draws on top of the left edge. */
#page-content-wrapper {
    margin-left: 260px;
    width: calc(100% - 260px);
    max-width: calc(100vw - 260px);
    min-width: 0;
    min-height: 100vh;
    background: var(--page-bg);
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

#wrapper.toggled #sidebar-wrapper {
    width: 64px;
}

#wrapper.toggled #page-content-wrapper {
    margin-left: 64px;
    width: calc(100% - 64px);
    max-width: calc(100vw - 64px);
}

/* ========================================
   SIDEBAR COLLAPSED (ICON-ONLY)
   ======================================== */

/* Brand area */
#wrapper.toggled .sidebar-heading {
    padding: 1.1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
#wrapper.toggled .sidebar-heading > div {
    justify-content: center;
}
#wrapper.toggled .logo-icon {
    margin: 0 !important;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
}
#wrapper.toggled .logo-text {
    display: none;
}

/* Section labels */
#wrapper.toggled .sidebar-section-label {
    font-size: 0;
    height: 1px;
    padding: 0;
    margin: 0.3rem 0.5rem;
    overflow: hidden;
    background: rgba(255,255,255,0.12);
    opacity: 1;
}

/* Nav items */
#wrapper.toggled #sidebar-wrapper .list-group {
    padding: 0.6rem 0.5rem;
}
#wrapper.toggled #sidebar-wrapper .list-group-item {
    padding: 0.8rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-sm);
}
#wrapper.toggled #sidebar-wrapper .list-group-item .nav-label {
    display: none;
}
#wrapper.toggled #sidebar-wrapper .list-group-item i {
    margin: 0 !important;
    width: auto;
    font-size: 1.15rem;
}
#wrapper.toggled #sidebar-wrapper .list-group-item:hover {
    transform: none;
    background: rgba(255,255,255,0.15);
}
#wrapper.toggled .sidebar-online-dot {
    display: none;
}

/* CSS-only tooltip on nav items (collapsed mode only) */
#wrapper.toggled #sidebar-wrapper .list-group-item[data-label] {
    position: relative;
}
#wrapper.toggled #sidebar-wrapper .list-group-item[data-label]:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(11,61,46,0.95);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    pointer-events: none;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    letter-spacing: 0.01em;
}

/* Footer */
#wrapper.toggled .sidebar-footer {
    padding: 0.75rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
#wrapper.toggled .sidebar-footer > .d-flex {
    justify-content: center;
    margin-bottom: 0 !important;
}
#wrapper.toggled .sidebar-footer .avatar-circle {
    margin: 0 !important;
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
}
#wrapper.toggled .sidebar-footer .user-info-text {
    display: none;
}
#wrapper.toggled .sidebar-footer form {
    display: flex;
    justify-content: center;
    width: 100%;
}
#wrapper.toggled .sidebar-footer .btn {
    padding: 0.45rem 0.6rem;
    width: auto !important;
}
#wrapper.toggled .sidebar-footer .btn .btn-label {
    display: none;
}

/* ========================================
   SIDEBAR COMPONENTS
   ======================================== */

.sidebar-heading {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.logo-icon img {
    width: 100%;
    height: 100%;
    padding: 0.2rem;
    object-fit: contain;
    display: block;
}

.sidebar-heading h6 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--pure-white);
    margin: 0;
    letter-spacing: -0.02em;
}

.sidebar-subtitle {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 400;
}

/* Sidebar Navigation */
#sidebar-wrapper .list-group {
    padding: 1rem 0.75rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

#sidebar-wrapper .list-group-item {
    border: none;
    border-radius: 14px;
    margin-bottom: 0.45rem;
    color: rgba(255,255,255,1);
    background: transparent;
    font-weight: 600;
    padding: 0.9rem 1rem;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

#sidebar-wrapper .list-group-item::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: rgba(255,255,255,0.9);
    border-radius: 999px;
    transition: height 0.25s ease;
}

#sidebar-wrapper .list-group-item.active {
    background: rgba(255,255,255,0.12);
    color: var(--pure-white);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 6px 18px rgba(0,0,0,0.08);
}

#sidebar-wrapper .list-group-item.active::before {
    height: 52%;
}

#sidebar-wrapper .list-group-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--pure-white);
    transform: translateX(2px);
}

#sidebar-wrapper .list-group-item i {
    width: 24px;
    min-width: 24px;
    text-align: center;
    margin-right: 0;
    font-size: 1.2rem;
    opacity: 1;
    line-height: 1;
}

#sidebar-wrapper .list-group-item .nav-label {
    display: inline-block;
    line-height: 1.2;
    white-space: nowrap;
    font-size: 1.02rem;
}

/* Sidebar Footer */
.sidebar-footer {
    position: static;
    flex-shrink: 0;
    padding: 1.5rem;
    background: rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--sidebar-border);
}

.avatar-circle {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--pure-white);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.sidebar-footer .fw-bold {
    color: var(--pure-white);
    font-size: 0.95rem;
    font-weight: 600;
}

.sidebar-footer .text-muted {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
}

/* ========================================
   TOP NAVBAR
   ======================================== */

.navbar-top {
    background: var(--top-header-bg) !important;
    border-bottom: 1px solid #E2E8F0;
    padding: 1rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1100;
    backdrop-filter: blur(10px);
    background: rgba(255,255,255,0.95) !important;
}

.navbar-top .btn {
    background: transparent;
    border: none;
    color: var(--dark-text);
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.navbar-top .btn:hover {
    background: var(--soft-sage);
    color: var(--primary-green);
}

.status-live {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #10B981 0%, #16A34A 100%);
    color: var(--pure-white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
    animation: pulse-glow 2s infinite;
}

.status-live i {
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(16,185,129,0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(16,185,129,0.5);
    }
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background: var(--card-bg);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-2px);
}

.card-body {
    padding: 1.75rem;
}

.card-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--dark-text);
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

/* Sensor Cards */
.sensor-card {
    position: relative;
    overflow: hidden;
}

.sensor-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sensor-card:hover::before {
    opacity: 1;
}

.sensor-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sensor-icon i {
    position: relative;
    z-index: 1;
    color: var(--pure-white) !important;
}

.sensor-icon.bg-danger {
    background: var(--gradient-danger);
}

.sensor-icon.bg-primary {
    background: var(--gradient-primary);
}

.sensor-icon.bg-info {
    background: var(--gradient-info);
}

.sensor-icon.bg-purple {
    background: var(--gradient-success);
}

/* Action Cards */
.action-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.action-icon i {
    color: inherit !important;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    letter-spacing: -0.01em;
}

.btn-success, .btn-primary {
    background: var(--gradient-primary);
    color: var(--pure-white);
    box-shadow: 0 4px 12px rgba(20,90,50,0.3);
}

.btn-success:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20,90,50,0.4);
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    box-shadow: none;
}

.btn-outline-primary:hover {
    background: var(--primary-green);
    color: var(--pure-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20,90,50,0.3);
}

/* Harvest navigation sits on a dark header, so all actions need strong contrast. */
.page-header-bar .harvest-actions .btn-outline-primary,
.page-header-bar .harvest-actions .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.page-header-bar .harvest-actions .btn-outline-primary:hover,
.page-header-bar .harvest-actions .btn-outline-secondary:hover {
    background: #FFFFFF;
    color: var(--primary-green);
    border-color: #FFFFFF;
}

.page-header-bar .harvest-actions .btn-primary {
    background: #FFFFFF;
    color: var(--primary-green);
    box-shadow: none;
}

.page-header-bar .harvest-actions .btn-primary:hover {
    background: #EAF4EF;
    color: var(--primary-green);
}

.btn-outline-danger {
    background: transparent;
    color: var(--chili-red);
    border: 2px solid var(--chili-red);
}

.btn-outline-danger:hover {
    background: var(--chili-red);
    color: var(--pure-white);
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--gradient-danger);
    color: var(--pure-white);
    box-shadow: 0 4px 12px rgba(220,38,38,0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220,38,38,0.4);
}

/* ========================================
   FORMS
   ======================================== */

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 2px solid #E2E8F0;
    padding: 0.75rem 1rem;
    background: #F8FAFC;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(20,90,50,0.1);
    background: var(--pure-white);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* ========================================
   PROGRESS BARS
   ======================================== */

.progress {
    height: 8px;
    border-radius: 10px;
    background: #E2E8F0;
    overflow: hidden;
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,255,255,0.3) 50%, 
        transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-bar.bg-danger {
    background: var(--gradient-danger);
}

.progress-bar.bg-primary {
    background: var(--gradient-primary);
}

.progress-bar.bg-info {
    background: var(--gradient-info);
}

.progress-bar.bg-purple {
    background: var(--gradient-success);
}

/* ========================================
   ALERTS & NOTIFICATIONS
   ======================================== */

.alert {
    border-radius: var(--radius-sm);
    border: none;
    padding: 1rem 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    animation: slideInDown 0.4s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    color: #065F46;
}

.alert-danger {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    color: #991B1B;
}

.alert-info {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    color: #1E40AF;
}

.alert-warning {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    color: #92400E;
}

/* ========================================
   BADGES & STATUS
   ======================================== */

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.badge-success {
    background: var(--gradient-success);
    color: var(--pure-white);
}

.badge-danger {
    background: var(--gradient-danger);
    color: var(--pure-white);
}

.badge-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
    color: var(--pure-white);
}

/* ========================================
   TABLES
   ======================================== */

.table {
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.table thead th {
    background: var(--soft-sage);
    color: var(--dark-text);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    padding: 1rem;
}

.table tbody tr {
    background: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.table tbody td {
    border: none;
    padding: 1rem;
    vertical-align: middle;
}

.table tbody tr td:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.table tbody tr td:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ========================================
   IRRIGATION SPECIFIC
   ======================================== */

.irrigation-visual {
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
}

.irrigation-icon {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #0EA5E9;
    transition: all 0.5s ease;
    position: relative;
}

.irrigation-icon::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9 0%, #06B6D4 100%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.5s ease;
}

.irrigation-icon.active {
    background: var(--gradient-primary);
    color: var(--pure-white);
    animation: irrigation-pulse 2s infinite;
}

.irrigation-icon.active::before {
    opacity: 0.2;
}

@keyframes irrigation-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.irrigation-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.schedule-item {
    padding: 1rem;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.schedule-item:hover {
    background: var(--soft-sage);
    transform: translateX(4px);
}

/* ========================================
   DETECTION UPLOAD
   ======================================== */

.upload-area {
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    border: 2px dashed #CBD5E1;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-green);
    background: linear-gradient(135deg, #EAF4EF 0%, #D1FAE5 100%);
}

.upload-area.drag-over {
    border-color: var(--primary-green);
    background: var(--soft-sage);
    transform: scale(1.02);
}

.detection-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

#uploadPreview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    margin: 1rem auto;
    display: block;
}

.upload-preview {
    margin-top: 1.5rem;
}

.upload-preview.d-none {
    display: none !important;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-primary {
    color: var(--primary-green) !important;
}

.text-purple {
    color: var(--success-green) !important;
}

.text-muted {
    color: var(--sub-text) !important;
}

.bg-purple {
    background: var(--gradient-success) !important;
}

.bg-light-green {
    background: var(--soft-sage) !important;
}

/* ========================================
   SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* <= xl: keep a visible icon-only sidebar (like a mobile rail).
   Hamburger toggles `.toggled` to expand/collapse the sidebar. */
@media (max-width: 1199.98px) {
    body { overflow-x: hidden; }

    /* Sidebar rail (collapsed) by default */
    #sidebar-wrapper {
        width: 64px;
        transform: none;
        box-shadow: 4px 0 18px rgba(0, 0, 0, 0.12);
    }

    #page-content-wrapper {
        margin-left: 64px !important;
        width: calc(100% - 64px) !important;
        max-width: calc(100vw - 64px) !important;
    }

    /* Collapsed (rail) visuals without needing `.toggled` */
    .sidebar-heading {
        padding: 1.1rem 0.6rem;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .sidebar-heading > div { justify-content: center; }
    .logo-text { display: none !important; }
    .logo-icon { margin: 0 !important; width: 40px; height: 40px; font-size: 1.2rem; }

    .sidebar-section-label {
        font-size: 0;
        height: 1px;
        padding: 0;
        margin: 0.35rem 0.6rem;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.12);
        opacity: 1;
    }

    #sidebar-wrapper .list-group { padding: 0.6rem 0.5rem; }
    #sidebar-wrapper .list-group-item {
        padding: 0.8rem 0;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: var(--radius-sm);
    }
    #sidebar-wrapper .list-group-item .nav-label { display: none !important; }
    #sidebar-wrapper .list-group-item i {
        margin: 0 !important;
        width: auto;
        font-size: 1.15rem;
    }
    .sidebar-online-dot { display: none !important; }

    .sidebar-footer {
        padding: 0.75rem 0.4rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    .sidebar-footer > .d-flex { justify-content: center; margin-bottom: 0 !important; }
    .sidebar-footer .avatar-circle { margin: 0 !important; width: 36px; height: 36px; font-size: 0.9rem; }
    .sidebar-footer .user-info-text { display: none !important; }
    .sidebar-footer form { display: flex; justify-content: center; width: 100%; }
    .sidebar-footer .btn { padding: 0.45rem 0.6rem; width: auto !important; }
    .sidebar-footer .btn .btn-label { display: none !important; }

    /* Expanded sidebar when toggled */
    #wrapper.toggled #sidebar-wrapper { width: 260px; }
    #wrapper.toggled #page-content-wrapper {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
        max-width: calc(100vw - 260px) !important;
    }

    #wrapper.toggled .sidebar-heading {
        padding: 1.5rem 1rem;
        justify-content: flex-start;
        align-items: stretch;
    }
    #wrapper.toggled .sidebar-heading > div { justify-content: flex-start; }
    #wrapper.toggled .logo-icon { margin: 0 0.5rem 0 0 !important; width: 48px; height: 48px; font-size: 1.5rem; }
    #wrapper.toggled .logo-text { display: block !important; }

    #wrapper.toggled .sidebar-section-label {
        font-size: 0.65rem;
        height: auto;
        padding: 0.75rem 1.5rem 0.25rem;
        margin-top: 0.5rem;
        background: transparent;
        opacity: 1;
    }
    #wrapper.toggled #sidebar-wrapper .list-group { padding: 1rem 0.75rem; }
    #wrapper.toggled #sidebar-wrapper .list-group-item {
        padding: 0.85rem 1.25rem;
        justify-content: flex-start;
        align-items: center;
    }
    #wrapper.toggled #sidebar-wrapper .list-group-item .nav-label { display: inline !important; }
    #wrapper.toggled #sidebar-wrapper .list-group-item i {
        margin: 0 0.75rem 0 0 !important;
        width: 20px;
        font-size: 1.1rem;
    }
    #wrapper.toggled .sidebar-footer { padding: 1.25rem; align-items: stretch; }
    #wrapper.toggled .sidebar-footer .btn { padding: 0.45rem 0.75rem; width: 100% !important; }
    #wrapper.toggled .sidebar-footer .btn .btn-label { display: inline !important; }
}

@media (max-width: 768px) {
    .card-body {
        padding: 1.25rem;
    }
    
    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .sensor-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .sidebar-heading {
        padding: 1.5rem 1rem;
    }

    .page-header-bar {
        padding: 1.15rem 1.25rem;
    }

    .quick-action-card .action-icon {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .quick-action-card h5 {
        font-size: 1rem;
    }

    .navbar-top {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }

    .navbar-top .ms-auto {
        flex-wrap: wrap;
        justify-content: flex-end;
        row-gap: 0.35rem;
    }
}

@media (max-width: 576px) {
    #sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1090;
        background: rgba(2, 17, 12, 0.42);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    #wrapper.toggled #sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    #sidebar-wrapper {
        position: fixed !important;
        top: 0;
        bottom: auto;
        left: 0;
        height: 100vh;
        height: 100dvh;
        width: min(260px, 86vw);
        background: #0B3D2E !important;
        opacity: 1 !important;
        filter: none !important;
        z-index: 1200;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.2);
    }

    #wrapper.toggled #sidebar-wrapper {
        width: min(260px, 86vw) !important;
        background: #0B3D2E !important;
        opacity: 1 !important;
        filter: none !important;
        z-index: 1200;
        transform: translateX(0);
    }

    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow: visible;
    }

    #wrapper.toggled #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    #wrapper.toggled #sidebar-wrapper .logo-text,
    #wrapper.toggled #sidebar-wrapper .nav-label,
    #wrapper.toggled #sidebar-wrapper .user-info-text,
    #wrapper.toggled #sidebar-wrapper .sidebar-section-label {
        display: block !important;
    }

    #wrapper.toggled #sidebar-wrapper .sidebar-heading > div { justify-content: flex-start; }
    #wrapper.toggled #sidebar-wrapper .sidebar-heading { padding: 1.5rem 1rem; }
    #wrapper.toggled #sidebar-wrapper .logo-icon { margin: 0 0.5rem 0 0 !important; }
    #wrapper.toggled #sidebar-wrapper .list-group { padding: 1rem 0.75rem; }
    #wrapper.toggled #sidebar-wrapper .list-group-item {
        padding: 0.85rem 1.25rem;
        justify-content: flex-start;
    }
    #wrapper.toggled #sidebar-wrapper .list-group-item i {
        margin: 0 0.75rem 0 0 !important;
        width: 20px;
    }
    #wrapper.toggled #sidebar-wrapper .sidebar-footer {
        padding: 1.25rem;
        align-items: stretch;
    }
    #wrapper.toggled #sidebar-wrapper .sidebar-footer .user-info-text { display: block !important; }
    #wrapper.toggled #sidebar-wrapper .sidebar-footer .btn { width: 100% !important; }
    #wrapper.toggled #sidebar-wrapper .sidebar-footer .btn .btn-label { display: inline !important; }

    .navbar-top { min-height: 56px; }
    .navbar-top > .ms-3 { margin-left: 0.35rem !important; }
    main.container-fluid { padding: 0.85rem !important; }
    .row { --bs-gutter-x: 1rem; }
    .page-header-title { font-size: 1.2rem; }
    .page-header-bar h2 { line-height: 1.25; }
    .page-header-bar .page-header-sub { line-height: 1.4; }
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-responsive > .table { min-width: 680px; }
    .form-control, .form-select { min-height: 42px; }
    .btn { min-height: 42px; }
    
    .irrigation-icon {
        width: 120px;
        height: 120px;
        font-size: 3rem;
    }
    
    .navbar-top {
        padding: 0.75rem;
    }

    .page-header-bar {
        padding: 1rem;
        border-radius: var(--radius-sm);
    }

    .dashboard-chart-wrap {
        height: 170px;
    }

    .system-status-banner .status-live {
        font-size: 0.78rem;
        padding: 0.45rem 0.85rem;
    }

    .sensor-card .card-body {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease;
}

.animate-slide-up {
    animation: slideInUp 0.6s ease;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease;
}

/* Stagger animations for cards */
.card:nth-child(1) {
    animation-delay: 0.1s;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

.card:nth-child(3) {
    animation-delay: 0.3s;
}

.card:nth-child(4) {
    animation-delay: 0.4s;
}

/* ========================================
   BREADCRUMB
   ======================================== */

.breadcrumb {
    background: transparent;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    font-size: 0.82rem;
    color: var(--sub-text);
}

.breadcrumb-item.active {
    color: var(--dark-text);
    font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #CBD5E1;
    font-size: 0.75rem;
}

/* ========================================
   NAVBAR ENHANCEMENTS
   ======================================== */

.navbar-clock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.navbar-clock .clock-time {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark-text);
    letter-spacing: -0.01em;
}

.navbar-clock .clock-date {
    font-size: 0.72rem;
    color: var(--sub-text);
    font-weight: 500;
}

/* Notification Bell */
.notif-bell-btn {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 2px solid #E2E8F0;
    background: var(--pure-white);
    color: var(--dark-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.notif-bell-btn:hover {
    background: var(--soft-sage);
    border-color: var(--primary-green);
    color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20,90,50,0.15);
}

.notif-bell-btn .notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    background: var(--chili-red);
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: notif-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes notif-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* Divider in navbar */
.navbar-divider {
    width: 1px;
    height: 28px;
    background: #E2E8F0;
    margin: 0 0.5rem;
}

/* User avatar chip in navbar */
.navbar-user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--soft-sage);
    border-radius: 12px;
    padding: 0.35rem 0.85rem 0.35rem 0.35rem;
    text-decoration: none;
    color: var(--dark-text);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.navbar-user-chip:hover {
    border-color: var(--primary-green);
    background: white;
    box-shadow: 0 4px 12px rgba(20,90,50,0.12);
}

.navbar-user-chip .chip-avatar {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.navbar-user-chip .chip-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-text);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   ENHANCED SENSOR CARDS (INDIVIDUAL COLORS)
   ======================================== */

/* Temperature — red */
.sensor-card.s-temp {
    border-top: 4px solid #EF4444;
    background: linear-gradient(180deg, #fff5f5 0%, var(--pure-white) 40%);
}
.sensor-card.s-temp:hover { box-shadow: 0 8px 30px rgba(239,68,68,0.15); }
.sensor-card.s-temp .sensor-value-num { color: #DC2626; }

/* Moisture — blue */
.sensor-card.s-moisture {
    border-top: 4px solid #3B82F6;
    background: linear-gradient(180deg, #eff6ff 0%, var(--pure-white) 40%);
}
.sensor-card.s-moisture:hover { box-shadow: 0 8px 30px rgba(59,130,246,0.15); }
.sensor-card.s-moisture .sensor-value-num { color: #2563EB; }

/* Humidity — cyan */
.sensor-card.s-humidity {
    border-top: 4px solid #06B6D4;
    background: linear-gradient(180deg, #ecfeff 0%, var(--pure-white) 40%);
}
.sensor-card.s-humidity:hover { box-shadow: 0 8px 30px rgba(6,182,212,0.15); }
.sensor-card.s-humidity .sensor-value-num { color: #0891B2; }

/* pH — green */
.sensor-card.s-ph {
    border-top: 4px solid #16A34A;
    background: linear-gradient(180deg, #f0fdf4 0%, var(--pure-white) 40%);
}
.sensor-card.s-ph:hover { box-shadow: 0 8px 30px rgba(22,163,74,0.15); }
.sensor-card.s-ph .sensor-value-num { color: #15803D; }

/* Shared sensor value font */
.sensor-value-num {
    font-size: clamp(1.85rem, 5vw + 0.5rem, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
}

.sensor-value-unit {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.7;
    margin-left: 2px;
}

.sensor-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.dashboard-stat-card {
    border: 2px solid transparent;
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
    min-height: 188px;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

.dashboard-stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-green);
    box-shadow: 0 12px 35px rgba(20,90,50,0.15);
}

.dashboard-stat-card .card-body {
    height: 100%;
}

.dashboard-stat-card__body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100%;
}

.dashboard-stat-card__footer {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.dashboard-stat-card__hint {
    font-size: 0.72rem;
    color: #64748B;
    letter-spacing: 0.01em;
}

.dashboard-stat-card__rail {
    height: 8px;
    border-radius: 999px;
    background: #E2E8F0;
    overflow: hidden;
    position: relative;
}

.dashboard-stat-card__rail::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.dashboard-stat-card__rail--temp::after {
    width: 72%;
    background: linear-gradient(90deg, #FCA5A5 0%, #EF4444 100%);
}

.dashboard-stat-card__rail--moisture::after {
    width: 64%;
    background: linear-gradient(90deg, #93C5FD 0%, #2563EB 100%);
}

.dashboard-stat-card__rail--active::after {
    width: 100%;
    background: linear-gradient(90deg, #86EFAC 0%, #16A34A 100%);
}

.dashboard-stat-card__rail--irrigation::after {
    width: 38%;
    background: linear-gradient(90deg, #BBF7D0 0%, #22C55E 100%);
}

.dashboard-stat-card .sensor-icon {
    width: 48px;
    height: 48px;
    font-size: 1.15rem;
    margin-bottom: 0.65rem !important;
}

.dashboard-stat-card .sensor-label {
    margin-bottom: 0.35rem;
    font-size: 0.66rem;
}

.dashboard-stat-card .sensor-value-num {
    font-size: clamp(1.5rem, 4vw + 0.35rem, 2rem);
}

.dashboard-stat-card .sensor-value-unit {
    font-size: 0.85rem;
}

/* ========================================
   QUICK ACTION CARDS (HOVER GLOW)
   ======================================== */

.quick-action-card {
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1) !important;
    cursor: pointer;
}

.quick-action-card:hover {
    transform: translateY(-5px) !important;
    border-color: var(--primary-green);
    box-shadow: 0 12px 35px rgba(20,90,50,0.15) !important;
}

.quick-action-card .action-arrow {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--soft-sage);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.quick-action-card:hover .action-arrow {
    background: var(--primary-green);
    color: white;
    transform: translateX(4px);
}

.quick-actions-bar {
    display: grid;
    grid-template-columns: minmax(125px, 0.8fr) repeat(4, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.65rem;
    border: 1px solid #DDE8DF;
    border-radius: 14px;
    background: linear-gradient(135deg, #F8FCF8 0%, #FFFFFF 100%);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.quick-actions-bar__title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 0.65rem;
    color: #21432A;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quick-actions-bar__title small {
    margin-top: 0.2rem;
    color: #78907D;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.quick-action-link {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 0.55rem;
    padding: 0.5rem 0.55rem;
    border-radius: 10px;
    color: #334155;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.quick-action-link:hover {
    background: #EEF7EF;
    color: #163B22;
    transform: translateY(-1px);
}

.quick-action-link > span:nth-child(2) {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}

.quick-action-link strong {
    overflow: hidden;
    font-size: 0.74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-action-link small {
    margin-top: 0.2rem;
    overflow: hidden;
    color: #718096;
    font-size: 0.62rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-action-link__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    border-radius: 9px;
    font-size: 0.82rem;
}

.quick-action-link__icon--blue { background: #E0EEFF; color: #2563EB; }
.quick-action-link__icon--green { background: #DCFCE7; color: #16A34A; }
.quick-action-link__icon--orange { background: #FFEDD5; color: #EA580C; }
.quick-action-link__icon--amber { background: #FEF3C7; color: #A16207; }

.quick-action-link__arrow {
    margin-left: auto;
    color: #8AA893;
    font-size: 0.65rem;
}

@media (max-width: 991.98px) {
    .quick-actions-bar {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .quick-actions-bar__title {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .quick-actions-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ========================================
   SIDEBAR ENHANCEMENTS
   ======================================== */

.sidebar-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.5);
    padding: 0.9rem 1rem 0.35rem;
    margin-top: 0.5rem;
}

#sidebar-wrapper .list-group-item i {
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

#sidebar-wrapper .list-group-item:hover i,
#sidebar-wrapper .list-group-item.active i {
    opacity: 1;
}

/* Sidebar badge */
.sidebar-badge {
    margin-left: auto;
    background: rgba(239,68,68,0.9);
    color: white;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    min-width: 20px;
    text-align: center;
}

/* Sidebar online dot */
.sidebar-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22C55E;
    margin-left: auto;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(34,197,94,0.3);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94,0.3); }
    50%       { box-shadow: 0 0 0 5px rgba(34,197,94,0.1); }
}

/* Sidebar logo icon ring */
.logo-icon {
    position: relative;
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 15px;
    border: 2px solid rgba(255,255,255,0.2);
    animation: logo-ring 3s infinite;
}

@keyframes logo-ring {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%       { opacity: 0.8; transform: scale(1.08); }
}

/* Brand styling: highlight SiliTech word in chili red */
.brand-chili {
    color: #EF4444;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-chili:hover {
    color: #DC2626;
}

/* ========================================
   CHART CARD ENHANCEMENT
   ======================================== */

.chart-card .card-body {
    padding-bottom: 1rem;
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ========================================
   STATUS BANNER
   ======================================== */

.system-status-banner {
    border-radius: var(--radius) !important;
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%) !important;
    border-left: 5px solid var(--success-green) !important;
}

.system-status-banner.warning {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%) !important;
    border-left-color: var(--warning-orange) !important;
}

/* ========================================
   PAGE HEADER ENHANCEMENT
   ======================================== */

.page-header-bar {
    background: linear-gradient(135deg, var(--dark-green-main) 0%, var(--deep-forest) 100%);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    color: white;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: visible;
}

.page-header-bar::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.page-header-bar .btn-group,
.page-header-bar .dropdown-menu {
    overflow: visible;
    z-index: 1050;
}

.page-header-bar h2 {
    color: white;
    margin: 0;
    font-weight: 800;
    font-size: 1.6rem;
}

.page-header-bar h2 i,
.page-header-bar h2 .fas,
.page-header-bar h2 .far,
.page-header-bar h2 .fab {
    color: rgba(255,255,255,0.9);
}

.page-header-bar p {
    color: rgba(255,255,255,0.75);
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
}

.page-header-bar .page-header-title {
    font-size: clamp(1.2rem, 4.2vw + 0.35rem, 1.6rem);
    line-height: 1.25;
    word-wrap: break-word;
}

.page-header-bar .page-header-sub {
    font-size: clamp(0.8rem, 2vw + 0.35rem, 0.9rem);
}

.page-header-refresh {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.page-header-refresh:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.45);
}

/* Dashboard chart canvas wrapper — fluid height on small screens */
.dashboard-chart-wrap {
    position: relative;
    height: 140px;
    min-height: 120px;
}

.system-status-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #16A34A, #22C55E);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.system-status-title {
    color: #065F46;
    font-size: 0.95rem;
}

.system-status-desc {
    color: #047857;
}

.status-live--banner {
    white-space: nowrap;
}

/* ========================================
   MINI STAT STRIP
   ======================================== */

.mini-stat-strip {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.15);
}

.mini-stat i {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ========================================
   STAT CARDS WITH TREND
   ======================================== */

.stat-card {
    border-radius: var(--radius);
    border: none;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    position: relative;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sub-text);
}

.stat-card .stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    margin-top: 0.3rem;
}

.stat-card .stat-trend.up   { background: #D1FAE5; color: #065F46; }
.stat-card .stat-trend.down { background: #FEE2E2; color: #991B1B; }
.stat-card .stat-trend.neutral { background: #DBEAFE; color: #1E40AF; }

.stat-card-accent-blue   { border-left: 5px solid #3B82F6; }
.stat-card-accent-red    { border-left: 5px solid #EF4444; }
.stat-card-accent-green  { border-left: 5px solid #16A34A; }
.stat-card-accent-purple { border-left: 5px solid #8B5CF6; }
.stat-card-accent-cyan   { border-left: 5px solid #06B6D4; }
.stat-card-accent-orange { border-left: 5px solid #F97316; }

/* ========================================
   NOTIFICATION ITEMS
   ======================================== */

.notif-item {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.notif-item:hover {
    border-color: #E2E8F0;
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-2px);
}

.notif-item.unread {
    background: linear-gradient(to right, #f0fdf4, var(--card-bg));
    border-left: 4px solid var(--success-green);
}

.notif-item.level-warning {
    background: linear-gradient(to right, #fffbeb, var(--card-bg));
    border-left: 4px solid var(--warning-orange);
}

.notif-item.level-danger,
.notif-item.level-error {
    background: linear-gradient(to right, #fff5f5, var(--card-bg));
    border-left: 4px solid var(--chili-red);
}

.notif-dot {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notif-dot.level-info    { background: linear-gradient(135deg,#DBEAFE,#EFF6FF); color: #2563EB; }
.notif-dot.level-warning { background: linear-gradient(135deg,#FEF3C7,#FFFBEB); color: #D97706; }
.notif-dot.level-danger,
.notif-dot.level-error   { background: linear-gradient(135deg,#FEE2E2,#FFF5F5); color: #DC2626; }
.notif-dot.level-success { background: linear-gradient(135deg,#D1FAE5,#F0FDF4); color: #16A34A; }

.notif-time {
    font-size: 0.72rem;
    color: var(--sub-text);
    white-space: nowrap;
}

/* ========================================
   IRRIGATION PAGE SPECIFIC
   ======================================== */

.water-ripple {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 1.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.water-ripple .ripple-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(37,99,235,0.25);
    animation: ripple-expand 2.5s ease-out infinite;
}

.water-ripple .ripple-ring:nth-child(1) { width: 100%; height: 100%; animation-delay: 0s; }
.water-ripple .ripple-ring:nth-child(2) { width: 75%;  height: 75%;  animation-delay: 0.5s; }
.water-ripple .ripple-ring:nth-child(3) { width: 50%;  height: 50%;  animation-delay: 1s; }

.water-ripple.active .ripple-ring { border-color: rgba(20,90,50,0.3); }

@keyframes ripple-expand {
    0%   { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

.water-ripple .water-center {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg,#DBEAFE,#BFDBFE);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #2563EB;
    z-index: 1;
    box-shadow: 0 4px 16px rgba(37,99,235,0.25);
    transition: all 0.5s ease;
}

.water-ripple.active .water-center {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 6px 24px rgba(20,90,50,0.35);
    animation: water-pulse 1.5s ease-in-out infinite;
}

@keyframes water-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.08); }
}

.schedule-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--soft-sage);
    color: var(--primary-green);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.irrig-control-btn {
    min-width: 140px;
    padding: 0.9rem 1.75rem;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    border: none !important;
    outline: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}

.irrig-control-btn:hover  { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.2) !important; }
.irrig-control-btn:active { transform: translateY(0); }

.irrig-control-btn.irrig-on,
button.irrig-on {
    background: linear-gradient(135deg,#16A34A,#22C55E) !important;
    color: white !important;
    box-shadow: 0 4px 16px rgba(22,163,74,0.45) !important;
}

.irrig-control-btn.irrig-off,
button.irrig-off {
    background: linear-gradient(135deg,#DC2626,#EF4444) !important;
    color: white !important;
    box-shadow: 0 4px 16px rgba(220,38,38,0.45) !important;
}

/* ========================================
   DETECTION PAGE SPECIFIC
   ======================================== */

.how-it-works-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid #F1F5F9;
}

.how-it-works-step:last-child { border-bottom: none; }

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detection-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
}

.detection-result-badge.healthy  { background: #D1FAE5; color: #065F46; }
.detection-result-badge.pest     { background: #FEF3C7; color: #92400E; }
.detection-result-badge.disease  { background: #FEE2E2; color: #991B1B; }

/* Confidence progress bar colored */
.conf-bar { height: 8px; border-radius: 20px; background: #E2E8F0; overflow: hidden; }
.conf-bar-fill {
    height: 100%;
    border-radius: 20px;
    background: var(--gradient-success);
    transition: width 0.6s ease;
    position: relative;
}
.conf-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}
.conf-bar-fill.medium { background: linear-gradient(135deg, #F59E0B, #FBBF24); }
.conf-bar-fill.low    { background: var(--gradient-danger); }

/* Scan details toggle */
.recommendation-details summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    color: var(--primary-green);
    font-weight: 600;
    font-size: 0.82rem;
}

.recommendation-details summary::-webkit-details-marker { display: none; }

.detection-results-table {
    table-layout: fixed;
    width: 100%;
}

.detection-results-table .detection-col-date { width: 12%; }
.detection-results-table .detection-col-image { width: 10%; }
.detection-results-table .detection-col-result { width: 25%; }
.detection-results-table .detection-col-confidence { width: 14%; }
.detection-results-table .detection-col-notes { width: 12%; }
.detection-results-table .detection-col-recommendation { width: 27%; }

.detection-results-table th,
.detection-results-table td {
    overflow-wrap: anywhere;
    word-break: normal;
}

.detection-results-table .recommendation-details {
    min-width: 0;
}

.detection-results-table .recommendation-details > div {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* ========================================
   REPORTS PAGE SPECIFIC
   ======================================== */

.chart-container-card {
    position: relative;
}

.chart-period-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--soft-sage);
    color: var(--primary-green);
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.insight-pill {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.insight-pill:last-child { margin-bottom: 0; }
.insight-pill:hover { transform: translateX(4px); }

.insight-pill.insight-ok      { background: #F0FDF4; border-left: 3px solid #16A34A; color: #14532D; }
.insight-pill.insight-warn    { background: #FFFBEB; border-left: 3px solid #D97706; color: #78350F; }
.insight-pill.insight-info    { background: #EFF6FF; border-left: 3px solid #2563EB; color: #1E3A8A; }

.insight-pill .insight-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.insight-pill.insight-ok   .insight-icon { background: #D1FAE5; color: #16A34A; }
.insight-pill.insight-warn .insight-icon { background: #FDE68A; color: #D97706; }
.insight-pill.insight-info .insight-icon { background: #DBEAFE; color: #2563EB; }

/* ========================================
   SETTINGS PAGE SPECIFIC
   ======================================== */

.settings-card-section {
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.settings-card-section:hover { box-shadow: var(--card-hover-shadow); }

.settings-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    background: linear-gradient(135deg, var(--soft-sage) 0%, #fff 100%);
    border-bottom: 1px solid #E2E8F0;
}

.settings-section-header .sh-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--dark-text);
}

.settings-section-header .sh-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.settings-body { padding: 1.75rem; }

.device-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #F1F5F9;
}

.device-row:last-child { border-bottom: none; }

.device-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--soft-sage);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary-green);
    flex-shrink: 0;
}

.device-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22C55E;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.2);
}

.device-status-dot.offline { background: #94A3B8; box-shadow: none; }

.notif-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    border-bottom: 1px solid #F8FAFC;
}

.notif-pref-row:last-child { border-bottom: none; }

/* ========================================
   PAGINATION ENHANCED
   ======================================== */

.pagination .page-link {
    border-radius: 10px !important;
    margin: 0 2px;
    border: 2px solid #E2E8F0;
    color: var(--dark-text);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.5rem 0.9rem;
    transition: all 0.25s ease;
}

.pagination .page-link:hover {
    background: var(--soft-sage);
    border-color: var(--primary-green);
    color: var(--primary-green);
}

.pagination .page-item.active .page-link {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 12px rgba(20,90,50,0.3);
}

/* ========================================
    PLANTATION SENSOR GRID (6 rows × 1 sensor)
    ======================================== */

.sensor-plantation-card {
    border: 1px solid rgba(20, 90, 50, 0.12);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    background:
        radial-gradient(circle at top right, rgba(132, 204, 22, 0.12), transparent 28%),
        radial-gradient(circle at bottom left, rgba(22, 101, 52, 0.08), transparent 24%),
        linear-gradient(180deg, rgba(250, 253, 248, 0.98) 0%, rgba(241, 248, 236, 0.98) 100%);
}

.sensor-plantation-live {
    background: #DCFCE7;
    color: #14532D;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.35rem 0.65rem;
}

.sensor-plantation-chip {
    background: #E8F5E9;
    color: #166534;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.35rem 0.65rem;
}

.sensor-plantation-chip--active {
    background: #DCFCE7;
    color: #166534;
}

.sensor-plantation-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem;
    border-radius: 12px;
    background: linear-gradient(180deg, #F4FAF1 0%, #FFFFFF 100%);
    border: 1px solid #D9E7D3;
}

.sensor-plantation-legend__label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #52634D;
}

.sensor-plantation-legend__chip {
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.32rem 0.6rem;
}

.sensor-plantation-legend__chip--good { background: #D9F99D; color: #3F6212; }
.sensor-plantation-legend__chip--low { background: #FEF3C7; color: #92400E; }
.sensor-plantation-legend__chip--dry { background: #FEE2E2; color: #991B1B; }
.sensor-plantation-legend__chip--wet { background: #DBEAFE; color: #1D4ED8; }
.sensor-plantation-legend__chip--muted { background: #E5E7EB; color: #475569; }

#sensor-plantation-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-content: start;
}

.sensor-plantation-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.sensor-plantation-column {
    display: grid;
    gap: 0.85rem;
}

.sensor-plantation-column-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1F2937;
    padding: 0.55rem 0.85rem;
    border-radius: 12px;
    background: rgba(236, 253, 245, 0.9);
    border: 1px solid rgba(167, 243, 208, 0.7);
}

.sensor-plant-row + .sensor-plant-row {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.sensor-plant-row {
    position: relative;
    overflow: hidden;
    background: #FFFFFF;
    border: 1px solid rgba(209, 229, 211, 0.9);
    border-radius: 18px;
    padding: 0.85rem 0.85rem 0.95rem 0.95rem;
    min-height: 0;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.sensor-plant-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.95), rgba(74, 222, 128, 0.85));
}

.sensor-plant-row::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 18px 0 0 18px;
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.8), rgba(74, 222, 128, 0.6));
}

.sensor-plant-row__label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #25411D;
    text-align: left;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
}

.sensor-plant-zones {
    display: block;
}

.sensor-plant-zone.sensor-plant-cell {
    background: #fcfff8;
    border: 1px solid rgba(209, 229, 211, 0.9);
    border-radius: 16px;
    padding: 0.75rem 0.85rem;
    min-height: 0;
    font-size: 0.78rem;
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.05);
}

.sensor-plant-zone__title {
    font-weight: 700;
    font-size: 0.85rem;
    color: #334155;
    text-align: center;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.sensor-plant-cell {
    background: #ffffff;
    border: 1px solid rgba(209, 229, 211, 0.95);
    border-radius: 14px;
    padding: 0.75rem 0.75rem;
    min-height: 5.25rem;
    font-size: 0.78rem;
    line-height: 1.4;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.sensor-plant-cell:hover {
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.sensor-plant-cell__topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.55rem;
}

.sensor-plant-cell__status-badge,
.sensor-plant-cell__sensor-id {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.25rem 0.45rem;
}

.sensor-plant-cell__status-badge {
    border: 1px solid transparent;
}

.sensor-plant-cell__status-badge--good { background: #DCFCE7; color: #166534; }
.sensor-plant-cell__status-badge--low { background: #FEF3C7; color: #92400E; }
.sensor-plant-cell__status-badge--dry { background: #FEE2E2; color: #991B1B; }
.sensor-plant-cell__status-badge--wet { background: #DBEAFE; color: #1D4ED8; }
.sensor-plant-cell__status-badge--muted { background: #E5E7EB; color: #475569; }

.sensor-plant-cell__sensor-id {
    background: #F7F7F0;
    color: #5B5E4A;
    border: 1px solid #D9E7D3;
}

.sensor-plant-cell__metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}

.sensor-plant-cell__metric {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    border-radius: 10px;
    padding: 0.45rem 0.45rem 0.4rem;
    background: #FBFCF7;
    border: 1px solid #D9E7D3;
}

.sensor-plant-cell__metric--moisture {
    background: linear-gradient(180deg, #F0FDF4 0%, #FFFFFF 100%);
}

.sensor-plant-cell__metric--temperature {
    background: linear-gradient(180deg, #FFF7ED 0%, #FFFFFF 100%);
}

.sensor-plant-cell__metric .sensor-plant-cell__icon {
    width: 1rem;
    margin-top: 0.15rem;
    color: #6B7280;
}

.sensor-plant-cell__metric-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #667766;
    margin-bottom: 0.1rem;
}

.sensor-plant-cell__val {
    font-weight: 800;
    color: #1F2937;
    font-size: 0.98rem;
}

.sensor-plant-cell--good {
    border-color: rgba(22, 163, 74, 0.45);
    background: linear-gradient(180deg, #F0FDF4 0%, #fff 100%);
}

.sensor-plant-cell--good .sensor-plant-cell__status { color: #15803D; }

.sensor-plant-cell--dry {
    border-color: rgba(220, 38, 38, 0.45);
    background: linear-gradient(180deg, #FEF2F2 0%, #fff 100%);
}

.sensor-plant-cell--dry .sensor-plant-cell__status { color: #B91C1C; }

.sensor-plant-cell--low {
    border-color: rgba(234, 88, 12, 0.45);
    background: linear-gradient(180deg, #FFF7ED 0%, #fff 100%);
}

.sensor-plant-cell--low .sensor-plant-cell__status { color: #C2410C; }

.sensor-plant-cell--wet {
    border-color: rgba(37, 99, 235, 0.4);
    background: linear-gradient(180deg, #EFF6FF 0%, #fff 100%);
}

.sensor-plant-cell--wet .sensor-plant-cell__status { color: #1D4ED8; }

.sensor-plant-cell--muted {
    opacity: 0.85;
}

.sensor-plant-cell--muted .sensor-plant-cell__status { color: #94A3B8; }

.dashboard-stat-card__icon {
    width: 2.25rem !important;
    height: 2.25rem !important;
    font-size: 0.95rem !important;
}

.dashboard-stat-card__value {
    font-size: 1.65rem !important;
    line-height: 1.1;
}

.sensor-card.dashboard-stat-card:hover {
    transform: translateY(-4px);
}

.dashboard-overview-row .sensor-plantation-card .card-body {
    min-height: auto;
    padding: 1.2rem 1rem;
}

/* Plantation page: keep the six-row view dense and easy to scan. */
.sensor-plantation-card {
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
}

.sensor-plantation-card > .card-body {
    padding: 1.35rem;
}

.sensor-plantation-card .card-title {
    color: #19351f;
    letter-spacing: -0.01em;
}

.sensor-plantation-columns {
    gap: 1.25rem;
}

.sensor-plantation-column {
    gap: 0.7rem;
}

.sensor-plantation-column-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.7rem;
    border-radius: 9px;
    color: #45634a;
    background: rgba(236, 253, 245, 0.72);
    border-color: rgba(134, 239, 172, 0.55);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sensor-plant-row {
    border-radius: 14px;
    padding: 0.7rem 0.7rem 0.75rem 0.8rem;
    box-shadow: 0 7px 18px rgba(15, 23, 42, 0.045);
}

.sensor-plant-row::before {
    height: 3px;
}

.sensor-plant-row__label {
    display: inline-flex;
    align-items: center;
    min-height: 1.25rem;
    margin: 0 0 0.45rem;
    padding-left: 0.15rem;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    color: #315c39;
}

.sensor-plant-zone.sensor-plant-cell,
.sensor-plant-cell {
    border-radius: 12px;
    padding: 0.65rem 0.7rem;
    box-shadow: none;
}

.sensor-plant-zone__title {
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    color: #526477;
}

.sensor-plant-cell__topline {
    margin-bottom: 0.45rem;
}

.sensor-plant-cell__status-badge,
.sensor-plant-cell__sensor-id {
    font-size: 0.58rem;
    padding: 0.22rem 0.42rem;
}

.sensor-plant-cell__metric {
    min-width: 0;
    gap: 0.35rem;
    padding: 0.38rem 0.42rem;
    border-radius: 8px;
}

.sensor-plant-cell__metric-label {
    font-size: 0.56rem;
}

.sensor-plant-cell__val {
    font-size: 0.9rem;
}

@media (max-width: 767.98px) {
    .sensor-plantation-card > .card-body {
        padding: 1rem;
    }

    .sensor-plantation-columns {
        gap: 0.75rem;
    }
}

@media (max-width: 991.98px) {
    #sensor-plantation-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .sensor-plantation-legend {
        align-items: flex-start;
    }

    .sensor-plant-cell__metrics {
        grid-template-columns: 1fr;
    }

    .sensor-plant-zones {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .sensor-plant-zone.sensor-plant-cell {
        min-height: 4.5rem;
        font-size: 0.68rem;
    }
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state .empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, #F1F5F9, #E2E8F0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #94A3B8;
    margin: 0 auto 1rem;
}

.empty-state p {
    color: var(--sub-text);
    font-size: 0.9rem;
    max-width: 260px;
    margin: 0 auto;
}

/* ========================================
   TABLE ENHANCEMENTS
   ======================================== */

.table-card th {
    background: var(--soft-sage) !important;
    color: var(--dark-text);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.9rem 1rem;
    border: none;
}

.table-card td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: middle;
    color: var(--dark-text);
    font-size: 0.9rem;
}

.table-card tbody tr:hover td { background: #FAFCFF; }
.table-card tbody tr:last-child td { border-bottom: none; }

/* ========================================
   FORM SWITCH ENHANCED
   ======================================== */

.form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
    border-radius: 50px;
    border: 2px solid #E2E8F0;
    background-color: #E2E8F0;
    transition: all 0.3s ease;
}

.form-switch .form-check-input:checked {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    box-shadow: 0 2px 8px rgba(20,90,50,0.3);
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    body * {
        visibility: hidden;
    }
    
    #reports-printable,
    #reports-printable * {
        visibility: visible;
    }
    
    #reports-printable {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: white;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
