:root {
      --bg: #f4f7fb;
      --surface: #ffffff;
      --line: #e5ebf3;
      --text: #172033;
      --muted: #70809a;
      --primary: #1f6feb;
      --primary-soft: rgba(31, 111, 235, 0.10);
      --success: #12b76a;
      --success-soft: rgba(18, 183, 106, 0.12);
      --warning: #f79009;
      --warning-soft: rgba(247, 144, 9, 0.12);
      --danger: #f04438;
      --danger-soft: rgba(240, 68, 56, 0.12);
      --purple: #7a5af8;
      --shadow: 0 10px 30px rgba(12, 28, 63, 0.08);
      --radius: 20px;
      --sidebar-width: 280px;
    }

    * {
      box-sizing: border-box;
    }

    html,
    body {
      min-height: 100%;
    }

    body {
      margin: 0;
      font-family: 'Inter', sans-serif;
      background: var(--bg);
      color: var(--text);
    }

    a {
      text-decoration: none;
    }

    button {
      font: inherit;
    }

    .layout {
      min-height: 100vh;
      display: flex;
    }

    .sidebar {
      width: var(--sidebar-width);
      background: linear-gradient(180deg, #0d1b3d 0%, #132c62 50%, #103d58 100%);
      color: #fff;
      padding: 24px 18px;
      position: fixed;
      top: 0;
      bottom: 0;
      left: 0;
      overflow-y: auto;
      z-index: 1040;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 6px 10px 22px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.12);
      margin-bottom: 22px;
    }

    .brand-logo {
      width: 46px;
      height: 46px;
      border-radius: 14px;
      display: grid;
      place-items: center;
      background: linear-gradient(135deg, #21c97a, #2f80ed);
      font-size: 1.4rem;
      box-shadow: 0 12px 30px rgba(47, 128, 237, 0.35);
    }

    .brand h4 {
      margin: 0;
      font-size: 1rem;
      font-weight: 800;
      letter-spacing: 0.2px;
    }

    .brand span {
      color: rgba(255, 255, 255, 0.7);
      font-size: 0.83rem;
    }

    .menu-title {
      padding: 0 10px;
      margin: 22px 0 10px;
      font-size: 0.74rem;
      font-weight: 700;
      letter-spacing: 0.12em;
      color: rgba(255, 255, 255, 0.52);
      text-transform: uppercase;
    }

    .nav-pills .nav-link {
      color: rgba(255, 255, 255, 0.82);
      border-radius: 16px;
      padding: 12px 14px;
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 600;
      margin-bottom: 6px;
      transition: 0.25s ease;
    }

    .nav-pills .nav-link i {
      font-size: 1.1rem;
    }

    .nav-pills .nav-link:hover,
    .nav-pills .nav-link.active {
      background: rgba(255, 255, 255, 0.14);
      color: #fff;
      transform: translateX(2px);
    }

    .sidebar-card {
      margin-top: 24px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 20px;
      padding: 18px;
    }

    .sidebar-card h6 {
      font-weight: 700;
      margin-bottom: 10px;
    }

    .sidebar-card p {
      font-size: 0.86rem;
      color: rgba(255, 255, 255, 0.72);
      line-height: 1.5;
      margin-bottom: 14px;
    }

    .main {
      margin-left: var(--sidebar-width);
      width: calc(100% - var(--sidebar-width));
      padding: 24px;
    }

    .topbar {
      background: rgba(255, 255, 255, 0.88);
      backdrop-filter: blur(14px);
      border: 1px solid rgba(229, 235, 243, 0.9);
      border-radius: 24px;
      padding: 16px 20px;
      box-shadow: var(--shadow);
      margin-bottom: 22px;
    }

    .page-title h2 {
      margin: 0;
      font-size: 1.7rem;
      font-weight: 800;
    }

    .page-title p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 0.95rem;
    }

    .search-box {
      position: relative;
    }

    .search-box i {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      color: #8c9ab0;
      pointer-events: none;
    }

    .search-box input {
      width: 100%;
      padding: 12px 14px 12px 42px;
      border-radius: 14px;
      border: 1px solid var(--line);
      background: #f8fbff;
      outline: none;
    }

    .search-box input:focus {
      border-color: rgba(31, 111, 235, 0.35);
      box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.10);
    }

    .icon-btn {
      width: 46px;
      height: 46px;
      border-radius: 14px;
      border: 1px solid var(--line);
      background: #fff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: var(--text);
      position: relative;
      padding: 0;
    }

    .notif-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: var(--danger);
      position: absolute;
      right: 10px;
      top: 10px;
      border: 2px solid #fff;
    }

    .profile-pill {
      display: flex;
      align-items: center;
      gap: 12px;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 8px 12px;
      min-width: 0;
    }

    .profile-avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      background: linear-gradient(135deg, #1f6feb, #21c97a);
      color: #fff;
      display: grid;
      place-items: center;
      font-weight: 700;
      flex-shrink: 0;
    }

    .dash-card {
      background: var(--surface);
      border-radius: var(--radius);
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
      padding: 20px;
      height: 100%;
    }

    .metric-card {
      position: relative;
      overflow: hidden;
    }

    .metric-card::after {
      content: "";
      position: absolute;
      width: 120px;
      height: 120px;
      border-radius: 50%;
      right: -35px;
      top: -35px;
      background: rgba(255, 255, 255, 0.22);
    }

    .metric-card.primary {
      background: linear-gradient(135deg, #1f6feb, #4c8df5);
      color: #fff;
      border: none;
    }

    .metric-card.success {
      background: linear-gradient(135deg, #12b76a, #2fd184);
      color: #fff;
      border: none;
    }

    .metric-card.warning {
      background: linear-gradient(135deg, #f79009, #ffad33);
      color: #fff;
      border: none;
    }

    .metric-card.purple {
      background: linear-gradient(135deg, #7a5af8, #9b7bff);
      color: #fff;
      border: none;
    }

    .metric-top {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      position: relative;
      z-index: 1;
      gap: 12px;
    }

    .metric-label {
      font-size: 0.92rem;
      opacity: 0.95;
      margin-bottom: 10px;
    }

    .metric-value {
      font-size: 2rem;
      font-weight: 800;
      line-height: 1;
      margin-bottom: 10px;
    }

    .metric-foot {
      display: flex;
      justify-content: space-between;
      align-items: center;
      position: relative;
      z-index: 1;
      font-size: 0.88rem;
      opacity: 0.95;
      gap: 12px;
      flex-wrap: wrap;
    }

    .metric-icon {
      width: 52px;
      height: 52px;
      border-radius: 16px;
      display: grid;
      place-items: center;
      background: rgba(255, 255, 255, 0.18);
      font-size: 1.35rem;
      flex-shrink: 0;
    }

    .section-title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 18px;
      gap: 12px;
      flex-wrap: wrap;
    }

    .section-title h5,
    .section-title h6 {
      margin: 0;
      font-weight: 800;
    }

    .section-title p {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 0.9rem;
    }

    .chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      border-radius: 999px;
      padding: 7px 12px;
      font-size: 0.83rem;
      font-weight: 700;
      white-space: nowrap;
    }

    .chip.success {
      background: var(--success-soft);
      color: var(--success);
    }

    .chip.warning {
      background: var(--warning-soft);
      color: var(--warning);
    }

    .chip.danger {
      background: var(--danger-soft);
      color: var(--danger);
    }

    .chip.primary {
      background: var(--primary-soft);
      color: var(--primary);
    }

    .chip.purple {
      background: rgba(122, 90, 248, 0.12);
      color: var(--purple);
    }

    .weather-panel {
      background: linear-gradient(135deg, #132c62, #1f6feb);
      color: #fff;
      border-radius: var(--radius);
      padding: 24px;
      height: 100%;
      position: relative;
      overflow: hidden;
    }

    .weather-panel::before,
    .weather-panel::after {
      content: "";
      position: absolute;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.08);
    }

    .weather-panel::before {
      width: 220px;
      height: 220px;
      top: -70px;
      right: -70px;
    }

    .weather-panel::after {
      width: 160px;
      height: 160px;
      bottom: -50px;
      left: -50px;
    }

    .weather-temp {
      font-size: 3.2rem;
      font-weight: 800;
      line-height: 1;
    }

    .weather-small {
      color: rgba(255, 255, 255, 0.82);
      font-size: 0.92rem;
    }

    .mini-stat-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      margin-top: 20px;
    }

    .mini-stat {
      background: rgba(255, 255, 255, 0.12);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 16px;
      padding: 14px;
    }

    .mini-stat span {
      display: block;
      font-size: 0.82rem;
      color: rgba(255, 255, 255, 0.75);
      margin-bottom: 6px;
    }

    .mini-stat strong {
      font-size: 1rem;
      font-weight: 800;
    }

    .zone-list,
    .reco-list,
    .alert-list,
    .schedule-list,
    .tasks-list {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .zone-item {
      border: 1px solid var(--line);
      border-radius: 18px;
      padding: 16px;
      background: #fbfdff;
    }

    .zone-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
      gap: 10px;
      flex-wrap: wrap;
    }

    .zone-name {
      font-weight: 700;
      font-size: 1rem;
    }

    .zone-sub {
      font-size: 0.86rem;
      color: var(--muted);
      margin-top: 2px;
    }

    .zone-metrics {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
    }

    .zone-metric {
      background: #fff;
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 12px;
      min-width: 0;
    }

    .zone-metric span {
      display: block;
      font-size: 0.78rem;
      color: var(--muted);
      margin-bottom: 6px;
    }

    .zone-metric strong {
      font-size: 1rem;
      font-weight: 800;
      display: block;
      overflow-wrap: anywhere;
    }

    .reco-item,
    .alert-item,
    .schedule-item,
    .task-item {
      display: flex;
      gap: 14px;
      align-items: flex-start;
      padding: 14px;
      border-radius: 18px;
      border: 1px solid var(--line);
      background: #fbfdff;
    }

    .reco-icon,
    .alert-icon,
    .schedule-icon,
    .task-check {
      width: 44px;
      height: 44px;
      border-radius: 14px;
      display: grid;
      place-items: center;
      flex-shrink: 0;
      font-size: 1.1rem;
    }

    .reco-icon.primary,
    .schedule-icon.primary,
    .task-check.primary {
      background: var(--primary-soft);
      color: var(--primary);
    }

    .reco-icon.success,
    .schedule-icon.success,
    .task-check.success {
      background: var(--success-soft);
      color: var(--success);
    }

    .reco-icon.warning,
    .alert-icon.warning,
    .schedule-icon.warning {
      background: var(--warning-soft);
      color: var(--warning);
    }

    .alert-icon.danger {
      background: var(--danger-soft);
      color: var(--danger);
    }

    .reco-icon.purple {
      background: rgba(122, 90, 248, 0.12);
      color: var(--purple);
    }

    .item-title {
      font-weight: 700;
      margin-bottom: 4px;
    }

    .item-text {
      color: var(--muted);
      font-size: 0.9rem;
      line-height: 1.5;
      margin: 0;
    }

    .table-wrap {
      overflow-x: auto;
    }

    .custom-table {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0 10px;
    }

    .custom-table thead th {
      border: none;
      color: var(--muted);
      font-size: 0.82rem;
      font-weight: 700;
      padding: 0 14px 4px;
      white-space: nowrap;
    }

    .custom-table tbody tr {
      background: #fbfdff;
      box-shadow: inset 0 0 0 1px var(--line);
    }

    .custom-table tbody td {
      padding: 14px;
      border: none;
      vertical-align: middle;
      font-size: 0.92rem;
      white-space: nowrap;
    }

    .custom-table tbody tr td:first-child {
      border-top-left-radius: 16px;
      border-bottom-left-radius: 16px;
    }

    .custom-table tbody tr td:last-child {
      border-top-right-radius: 16px;
      border-bottom-right-radius: 16px;
    }

    .crop-badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-weight: 700;
    }

    .crop-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      display: inline-block;
    }

    .soil-map {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .soil-cell {
      min-height: 108px;
      border-radius: 18px;
      padding: 14px;
      color: #fff;
      position: relative;
      overflow: hidden;
    }

    .soil-cell::after {
      content: "";
      position: absolute;
      width: 90px;
      height: 90px;
      border-radius: 50%;
      right: -24px;
      bottom: -24px;
      background: rgba(255, 255, 255, 0.13);
    }

    .soil-cell h6 {
      margin: 0 0 8px;
      font-weight: 800;
      position: relative;
      z-index: 1;
    }

    .soil-cell p {
      margin: 0;
      font-size: 0.86rem;
      color: rgba(255, 255, 255, 0.86);
      position: relative;
      z-index: 1;
    }

    .moist-low {
      background: linear-gradient(135deg, #f04438, #ff6a60);
    }

    .moist-mid {
      background: linear-gradient(135deg, #f79009, #ffb84d);
    }

    .moist-good {
      background: linear-gradient(135deg, #12b76a, #38d593);
    }

    .moist-high {
      background: linear-gradient(135deg, #1f6feb, #62a0ff);
    }

    .chart-box {
      position: relative;
      width: 100%;
    }

    .chart-box.climate {
      height: 320px;
    }

    .chart-box.water {
      height: 280px;
    }

    .footer-note {
      margin-top: 18px;
      color: var(--muted);
      font-size: 0.85rem;
      text-align: right;
    }

    @media (max-width: 1199px) {
      .zone-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 991px) {
      .sidebar {
        position: static;
        width: 100%;
        height: auto;
      }

      .main {
        margin-left: 0;
        width: 100%;
      }

      .layout {
        flex-direction: column;
      }
    }

    @media (max-width: 767px) {
      .main {
        padding: 14px;
      }

      .topbar {
        padding: 14px;
      }

      .page-title h2 {
        font-size: 1.4rem;
      }

      .zone-metrics,
      .soil-map,
      .mini-stat-grid {
        grid-template-columns: 1fr;
      }

      .chart-box.climate {
        height: 260px;
      }

      .chart-box.water {
        height: 240px;
      }
    }