html, body {
  margin: 0 !important;
  padding: 0 !important;
  background: #f4f7f5 !important;
  overflow-x: hidden !important;
  font-family: Inter, Arial, sans-serif !important;
}

.navbar, .web-header, .website-navbar, .web-footer, footer,
.footer-powered, .powered-by, .newsletter-section, .page-footer {
  display: none !important;
  height: 0 !important;
  visibility: hidden !important;
  overflow: hidden !important;
}

.fe-app {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}

.fe-sidebar {
  background: linear-gradient(180deg, #06381A, #07592A);
  color: white;
  padding: 24px 18px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  box-sizing: border-box;
}

.fe-logo-title {
  font-size: 28px;
  font-weight: 900;
}

.fe-logo-title span {
  color: #7ed957;
}

.fe-menu a {
  display: flex;
  gap: 12px;
  color: white !important;
  text-decoration: none !important;
  padding: 13px 14px;
  border-radius: 12px;
  margin-bottom: 7px;
  font-weight: 750;
}

.fe-menu a:hover,
.fe-menu a.active {
  background: rgba(255,255,255,.14);
}

.fe-weather-box {
  margin-top: 22px;
  background: rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 16px;
}

.fe-main {
  min-width: 0;
  overflow-x: hidden;
}

.fe-header {
  height: 76px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  box-shadow: 0 4px 18px rgba(0,0,0,.06);
}

.fe-header-title {
  font-size: 24px;
  font-weight: 900;
}

.fe-search {
  width: 320px;
  max-width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px 16px;
}

.fe-content {
  padding: 26px 28px 46px;
  box-sizing: border-box;
}

.fe-hero-banner,
.fe-kpi,
.fe-panel {
  background: white;
  border-radius: 18px;
  box-shadow: 0 8px 25px rgba(0,0,0,.07);
  border: 1px solid #eef2f0;
}

.fe-hero-banner {
  background: linear-gradient(90deg, #ffffff, #e8f7ee);
  padding: 28px;
  min-height: 135px;
  display: flex;
  align-items: center;
}

.fe-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 16px;
  margin-top: 22px;
}

.fe-kpi {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 22px;
  text-decoration: none !important;
  color: #111827 !important;
}

.fe-kpi-icon {
  width: 58px;
  height: 58px;
  min-width: 58px;
  border-radius: 50%;
  background: #ddf4e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
}

.fe-kpi h2 {
  font-size: 26px;
  margin: 7px 0 3px;
  font-weight: 900;
}

.fe-kpi h3 {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

.fe-trend {
  color: #128a3c;
  font-size: 12px;
  font-weight: 800;
}

.fe-grid-2 {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1.2fr);
  gap: 18px;
  margin-top: 18px;
}

.fe-grid-3 {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1.25fr) minmax(0,1fr);
  gap: 18px;
  margin-top: 18px;
}

.fe-panel {
  padding: 22px;
}

.fe-list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.fe-badge {
  padding: 5px 10px;
  border-radius: 999px;
  background: #eaf6ef;
  color: #128a3c;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.fe-chart-placeholder {
  height: 220px;
  border-radius: 16px;
  background: linear-gradient(180deg,#f7fcf9,#eaf6ef);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #128a3c;
  font-weight: 900;
}

.fe-map {
  height: 260px;
  border-radius: 16px;
  background: linear-gradient(rgba(5,70,30,.2),rgba(5,70,30,.2)),
    url("https://images.unsplash.com/photo-1500382017468-9049fed747ef?q=80&w=1200");
  background-size: cover;
  background-position: center;
  position: relative;
}

.fe-pin {
  position: absolute;
  background: #5dbb57;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

@media(max-width:1200px) {
  .fe-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .fe-grid-2, .fe-grid-3 { grid-template-columns: 1fr; }
}

@media(max-width:850px) {
  .fe-app { grid-template-columns: 1fr; }
  .fe-sidebar { position: relative; height: auto; }
  .fe-header { height: auto; display: block; padding: 18px; }
  .fe-search { width: 100%; margin: 14px 0; }
  .fe-kpi-grid { grid-template-columns: 1fr; }
}

.fe-module-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:20px;
}

.fe-module-head h2{
  margin:0;
  font-size:26px;
  font-weight:900;
}

.fe-module-head p{
  margin:5px 0 0;
  color:#6b7280;
}

.fe-small-btn{
  background:#16883d;
  color:white;
  border:0;
  border-radius:10px;
  padding:10px 16px;
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
}

.fe-panel label{
  display:block;
  margin-top:12px;
  font-weight:800;
}

.fe-panel .form-control{
  width:100%;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:10px 12px;
  margin-top:5px;
}

/* ===== FarmerP Portal Layout Final Fix ===== */

html,
body {
  width: 100% !important;
  min-height: 100% !important;
  overflow-x: hidden !important;
}

.page_content,
.page-content,
.web-page-content,
.main-section,
.container,
.container-fluid {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.fe-app {
  width: 100vw !important;
  max-width: 100vw !important;
  display: grid !important;
  grid-template-columns: 280px calc(100vw - 280px) !important;
  background: #f4f7f5 !important;
}

.fe-sidebar {
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  height: 100vh !important;
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

.fe-main {
  width: calc(100vw - 280px) !important;
  max-width: calc(100vw - 280px) !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
}

.fe-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.fe-content {
  width: 100% !important;
  max-width: 100% !important;
  padding: 24px !important;
  box-sizing: border-box !important;
}

.fe-hero-banner {
  width: 100% !important;
  box-sizing: border-box !important;
}

.fe-kpi-grid {
  grid-template-columns: repeat(5, minmax(160px, 1fr)) !important;
}

.fe-grid-2 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) !important;
}

.fe-grid-3 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr) !important;
}

.fe-panel,
.fe-kpi,
.fe-card {
  min-width: 0 !important;
  overflow: hidden !important;
}

.fe-table-card {
  width: 100% !important;
  overflow-x: auto !important;
}

.fe-table-card table,
.fe-panel table {
  width: 100% !important;
  table-layout: auto !important;
}

.fe-menu a {
  font-size: 15px !important;
}

.fe-weather-box {
  margin-bottom: 24px !important;
}

.fe-chart-placeholder,
.fe-map {
  width: 100% !important;
  min-height: 230px !important;
}

.fe-list-row span:first-child {
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
}

/* Module views loaded inside portal */
#portal-content {
  width: 100% !important;
  max-width: 100% !important;
}

#portal-content .fe-panel {
  width: 100% !important;
  box-sizing: border-box !important;
}

.fe-module-head {
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 1350px) {
  .fe-kpi-grid {
    grid-template-columns: repeat(3, minmax(180px, 1fr)) !important;
  }

  .fe-grid-3 {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 1050px) {
  .fe-app {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .fe-sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    position: relative !important;
  }

  .fe-main {
    width: 100% !important;
    max-width: 100% !important;
  }

  .fe-header {
    position: relative !important;
  }

  .fe-kpi-grid,
  .fe-grid-2,
  .fe-grid-3 {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 650px) {
  .fe-content {
    padding: 14px !important;
  }

  .fe-header {
    padding: 16px !important;
  }

  .fe-search {
    width: 100% !important;
  }

  .fe-kpi {
    align-items: flex-start !important;
  }

  .fe-hero-banner h1 {
    font-size: 24px !important;
  }
}

/* Final dashboard layout fix */
.fe-content {
  max-width: 100% !important;
  overflow-x: hidden !important;
}

.fe-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  gap: 18px !important;
}

.fe-kpi {
  min-height: 130px !important;
  align-items: center !important;
  padding: 20px !important;
}

.fe-kpi > div:last-child {
  min-width: 0 !important;
  width: 100% !important;
}

.fe-kpi h3 {
  font-size: 14px !important;
  line-height: 1.2 !important;
  white-space: normal !important;
}

.fe-kpi h2 {
  font-size: 24px !important;
  line-height: 1.1 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}

.fe-trend {
  font-size: 13px !important;
  line-height: 1.2 !important;
  white-space: normal !important;
}

.fe-hero-banner h1 {
  font-size: clamp(34px, 4vw, 62px) !important;
  line-height: 1.05 !important;
}

.fe-grid-2,
.fe-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)) !important;
}

.fe-panel {
  min-width: 0 !important;
  overflow: hidden !important;
}

@media(max-width: 1500px) {
  .fe-kpi-grid {
    grid-template-columns: repeat(3, minmax(240px, 1fr)) !important;
  }
}

@media(max-width: 1100px) {
  .fe-kpi-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr)) !important;
  }
}

@media(max-width: 700px) {
  .fe-kpi-grid,
  .fe-grid-2,
  .fe-grid-3 {
    grid-template-columns: 1fr !important;
  }
}

.fe-header-actions{
    display:flex;
    align-items:center;
    gap:12px;
}

.fe-small-btn{
    background:#16883d;
    color:white !important;
    text-decoration:none !important;
    padding:10px 16px;
    border-radius:10px;
    font-weight:800;
    border:none;
    display:inline-flex;
    align-items:center;
    gap:8px;
}

.fe-small-btn:hover{
    background:#0f6a2f;
}

.fe-logo-link,
.fe-logo-wrap,
.fe-brand {
  cursor: pointer;
  text-decoration: none !important;
  color: inherit !important;
}

.portal-access-note{
  background:#eaf6ef;
  color:#06451f;
  border:1px solid #cfe9d8;
  border-radius:14px;
  padding:14px 18px;
  margin-bottom:18px;
  font-weight:800;
}

.fe-modal-lite{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  z-index:99999;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.fe-modal-lite-box{
  width:min(920px,96vw);
  max-height:88vh;
  overflow:auto;
  background:white;
  border-radius:20px;
  padding:28px;
  box-shadow:0 30px 80px rgba(0,0,0,.3);
}

.fe-modal-lite label{
  display:block;
  margin-top:12px;
  font-weight:900;
}

.fe-modal-lite .form-control{
  width:100%;
  border:1px solid #d1d5db;
  border-radius:10px;
  padding:11px 13px;
  margin-top:6px;
}

.fe-upload-box{
  border:2px dashed #b7d9c2;
  border-radius:16px;
  padding:28px;
  text-align:center;
  background:#f7fcf9;
  color:#06451f;
  font-weight:800;
}

.fe-status-pending{background:#fff7e6;color:#9a6700;}
.fe-status-pass{background:#eaf6ef;color:#128a3c;}
.fe-status-fail{background:#fdecec;color:#b42318;}

.fe-upload-box{
  border:2px dashed #b7d9c2;
  border-radius:16px;
  padding:30px;
  background:#f7fcf9;
  text-align:center;
  color:#06451f;
  font-weight:900;
}

.fe-panel canvas{
  width:100% !important;
  max-height:280px;
}

.fe-panel h2{
  font-weight:900;
}

.fe-empty-state{
  background:#f7fcf9;
  border:1px dashed #b7d9c2;
  border-radius:16px;
  padding:28px;
  text-align:center;
  color:#06451f;
}

.fe-panel canvas{
  width:100% !important;
  max-height:280px;
}

.fe-panel h2{
  font-weight:900;
}

.fe-empty-state{
  background:#f7fcf9;
  border:1px dashed #b7d9c2;
  border-radius:16px;
  padding:28px;
  text-align:center;
  color:#06451f;
}

.fe-user-menu{
  position:relative;
  display:flex;
  align-items:center;
}

.fe-user-btn{
  border:0;
  background:transparent;
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  padding:8px 10px;
  border-radius:14px;
}

.fe-user-btn:hover{
  background:#f3f7f4;
}

.fe-user-text{
  text-align:left;
  font-weight:900;
  color:#111827;
}

.fe-user-text small{
  display:block;
  color:#667085;
  font-weight:700;
}

.fe-user-dropdown{
  display:none;
  position:absolute;
  top:58px;
  right:0;
  min-width:230px;
  background:white;
  border:1px solid #e5e7eb;
  border-radius:16px;
  box-shadow:0 18px 45px rgba(16,24,40,.15);
  padding:10px;
  z-index:9999;
}

.fe-user-dropdown.show{
  display:block;
}

.fe-user-dropdown a{
  display:block;
  padding:12px 14px;
  color:#111827!important;
  text-decoration:none!important;
  border-radius:10px;
  font-weight:800;
}

.fe-user-dropdown a:hover{
  background:#eaf6ef;
  color:#006b36!important;
}

/* FORCE FIX: top-right user dropdown */
.fe-header{
  position:relative !important;
  overflow:visible !important;
}

.fe-user-menu{
  position:relative !important;
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  z-index:99999 !important;
}

.fe-user-btn{
  border:0 !important;
  background:transparent !important;
  display:flex !important;
  align-items:center !important;
  gap:10px !important;
  cursor:pointer !important;
  padding:8px 12px !important;
  border-radius:14px !important;
  min-width:190px !important;
}

.fe-user-btn:hover{
  background:#f3f7f4 !important;
}

.fe-user-text{
  text-align:left !important;
  font-weight:900 !important;
  color:#111827 !important;
  line-height:1.2 !important;
}

.fe-user-text small{
  display:block !important;
  color:#667085 !important;
  font-weight:700 !important;
  margin-top:4px !important;
}

.fe-caret{
  margin-left:auto !important;
  font-weight:900 !important;
}

.fe-user-dropdown{
  display:none !important;
  position:absolute !important;
  top:58px !important;
  right:0 !important;
  min-width:240px !important;
  background:#ffffff !important;
  border:1px solid #e5e7eb !important;
  border-radius:16px !important;
  box-shadow:0 18px 45px rgba(16,24,40,.18) !important;
  padding:10px !important;
  z-index:999999 !important;
}

.fe-user-dropdown.show{
  display:block !important;
}

.fe-user-dropdown a{
  display:block !important;
  padding:12px 14px !important;
  color:#111827 !important;
  text-decoration:none !important;
  border-radius:10px !important;
  font-weight:800 !important;
  white-space:nowrap !important;
}

.fe-user-dropdown a:hover{
  background:#eaf6ef !important;
  color:#006b36 !important;
}

/* GLOBAL DROPDOWN FIX */
.fe-app,
.fe-main,
.fe-content,
.fe-header,
.fe-panel,
.fe-module-head,
.fe-table-card,
.fe-modal-lite,
.fe-modal-lite-box {
  overflow: visible !important;
}

.fe-header {
  z-index: 9999 !important;
}

.fe-panel,
.fe-table-card {
  position: relative !important;
  z-index: 1 !important;
}

.dropdown-menu,
.awesomplete ul,
.awesomplete > ul,
.select2-container,
.select2-dropdown,
.ui-menu,
.form-control[data-fieldtype="Link"],
.frappe-control .awesomplete ul {
  z-index: 999999 !important;
  position: absolute !important;
}

.modal,
.modal-dialog,
.modal-content,
.fe-modal-lite {
  overflow: visible !important;
  z-index: 99999 !important;
}

.fe-modal-lite-box {
  overflow: visible !important;
}

/* Fix portal custom user menu */
.fe-user-menu {
  position: relative !important;
  z-index: 999999 !important;
}

.fe-user-dropdown {
  z-index: 9999999 !important;
}

/* Better selects/inputs inside portal forms */
.fe-panel select,
.fe-panel input,
.fe-panel textarea,
.fe-modal-lite select,
.fe-modal-lite input,
.fe-modal-lite textarea {
  position: relative !important;
  z-index: 2 !important;
}

/* Prevent tables from clipping dropdowns */
.table-responsive,
.datatable,
.dt-scrollable,
.dt-scrollable__no-data,
.dt-cell,
.dt-row,
.dt-instance {
  overflow: visible !important;
}

/* Proper portal form controls */
.fe-modal-lite select.form-control,
.fe-panel select.form-control {
  display:block !important;
  width:100% !important;
  height:46px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:10px 12px !important;
  background:#ffffff !important;
  color:#111827 !important;
  font-weight:700 !important;
  appearance:auto !important;
}

.fe-modal-lite input.form-control,
.fe-panel input.form-control {
  display:block !important;
  width:100% !important;
  height:46px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:10px 12px !important;
  background:#ffffff !important;
  color:#111827 !important;
}

/* hard fix for all portal form dropdowns */
.fe-panel select.form-control,
.fe-modal-lite select.form-control,
form select.form-control {
  display:block !important;
  width:100% !important;
  height:48px !important;
  min-height:48px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:10px 14px !important;
  background:#ffffff !important;
  color:#111827 !important;
  font-size:16px !important;
  font-weight:700 !important;
  appearance:auto !important;
  -webkit-appearance:menulist !important;
}

.fe-panel input.form-control,
.fe-modal-lite input.form-control,
form input.form-control {
  display:block !important;
  width:100% !important;
  height:48px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:10px 14px !important;
  background:#ffffff !important;
  color:#111827 !important;
  font-size:16px !important;
}

/* hard fix for all portal form dropdowns */
.fe-panel select.form-control,
.fe-modal-lite select.form-control,
form select.form-control {
  display:block !important;
  width:100% !important;
  height:48px !important;
  min-height:48px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:10px 14px !important;
  background:#ffffff !important;
  color:#111827 !important;
  font-size:16px !important;
  font-weight:700 !important;
  appearance:auto !important;
  -webkit-appearance:menulist !important;
}

.fe-panel input.form-control,
.fe-modal-lite input.form-control,
form input.form-control {
  display:block !important;
  width:100% !important;
  height:48px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:10px 14px !important;
  background:#ffffff !important;
  color:#111827 !important;
  font-size:16px !important;
}

/* FINAL SELECT FIX */
select.form-control,
.fe-panel select.form-control,
.fe-modal-lite select.form-control,
form select.form-control {
  display:block !important;
  width:100% !important;
  height:48px !important;
  min-height:48px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:10px 14px !important;
  background-color:#ffffff !important;
  color:#111827 !important;
  font-size:16px !important;
  font-weight:700 !important;
  appearance:auto !important;
  -webkit-appearance:menulist !important;
  white-space:normal !important;
}

/* FINAL HARD DROPDOWN FIX */
select,
select.form-control,
.fe-real-select,
.fe-panel select,
.fe-modal-lite select,
#portal-create-form select {
  display:block !important;
  width:100% !important;
  max-width:100% !important;
  height:48px !important;
  min-height:48px !important;
  line-height:48px !important;
  border:1px solid #d1d5db !important;
  border-radius:10px !important;
  padding:0 14px !important;
  background:#ffffff !important;
  color:#111827 !important;
  font-size:16px !important;
  font-weight:700 !important;
  appearance:auto !important;
  -webkit-appearance:menulist !important;
  white-space:nowrap !important;
  overflow:hidden !important;
}

#portal-create-form option,
.fe-modal-lite option,
.fe-panel option {
  display:block !important;
  padding:8px !important;
  white-space:normal !important;
}

#portal-create-form label,
.fe-modal-lite label,
.fe-panel label {
  display:block !important;
  font-weight:900 !important;
  margin:14px 0 7px !important;
}
