/* Only the server-selected phone shell changes; desktop styles are untouched. */
.sg-mobile-plant-filter-native { display: none !important; }
.sg-mobile-filters-toggle { display: none !important; }
.sg-mobile-alerts-toggle { display: none !important; }
.sg-mobile-statistics-toggle { display: none !important; }
.sg-mobile-nav-toggle,
.sg-mobile-alerts-toggle,
.sg-mobile-statistics-toggle,
.sg-mobile-nav-close,
.sg-mobile-nav-backdrop { display: none; }
.sg-mobile-filters-panel { display: contents; }
.sg-mobile .sg-global-actions-row,
.sg-mobile .sg-sidebar-header,
.sg-mobile #app-version { display: none; }
.mobile-app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(25, 42, 33, 0.28);
    color: #294735;
    font: 600 15px/1.2 "Segoe UI", Arial, sans-serif;
    pointer-events: all;
}
body:has(.sg-app-shell.sg-mobile):has(#page-content[data-dash-is-loading="true"]) #mobile-app-loading-overlay,
body:has(.sg-app-shell.sg-mobile):has([id^="generic-modal-"][data-dash-is-loading="true"]) #mobile-app-loading-overlay {
    display: flex;
}
@media (max-width: 767px), (pointer: coarse) and (max-height: 600px) {
    body:has(#page-content[data-dash-is-loading="true"]) #mobile-app-loading-overlay,
    body:has([id^="generic-modal-"][data-dash-is-loading="true"]) #mobile-app-loading-overlay {
        display: flex;
    }
    body:has(#page-content[data-dash-is-loading="true"]) .loading-spinner { visibility: hidden; }
}
.mobile-app-loading-overlay > span:last-child {
    padding: 13px 17px;
    border: 1px solid #d7e1da;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(25, 42, 33, 0.18);
}
.mobile-app-loading-spinner {
    width: 27px;
    height: 27px;
    border: 3px solid #cfe0d5;
    border-top-color: #23834a;
    border-radius: 50%;
    animation: mobile-app-loading-spin 0.75s linear infinite;
}
@keyframes mobile-app-loading-spin { to { transform: rotate(360deg); } }
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-config-disclosure {
    display: block;
    max-height: 58dvh;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid #d7e1da;
    border-radius: 10px;
    background: #f8fafc;
}
body:has(.sg-app-shell.sg-mobile) #statistics-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}
body:has(.sg-app-shell.sg-mobile) #statistics-view .sg-statistics-config-disclosure[open] {
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
}
body:has(.sg-app-shell.sg-mobile) #statistics-view:has(.sg-statistics-config-disclosure[open]) {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}
body:has(.sg-app-shell.sg-mobile) #statistics-view .sg-statistics-config-disclosure[open] + .sg-statistics-graph-card {
    display: none;
}
body:has(.sg-app-shell.sg-mobile) #statistics-view .sg-statistics-graph-card {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden !important;
}
/* The graph result and dcc.Graph have inline minimum heights for desktop.
   Let them shrink into the mobile modal's bounded graph area. */
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-graph-result {
    flex: 1 1 0 !important;
    height: 100%;
    min-height: 0 !important;
    overflow: hidden;
}
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics #statistics-graph {
    flex: 1 1 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100%;
}
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-is-expanded .sg-statistics-graph-card {
    flex: 1 1 0;
    height: 0 !important;
    min-height: 0;
}
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-config-summary {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 8px 12px;
    background: #edf5ef;
    color: #294735;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-config-summary::-webkit-details-marker { display: none; }
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-config-summary::after { content: "+"; font-size: 1.2rem; }
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-config-disclosure[open] .sg-statistics-config-summary::after { content: "−"; }
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-controls {
    padding: 0.65rem;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
body:has(.sg-app-shell.sg-mobile) #generic-modal-statistics .sg-statistics-controls-heading { display: none; }
.sg-mobile .sg-shell-body {
    position: relative;
    inset: auto;
    flex-direction: column;
    flex: 1 1 auto;
    width: 100%;
    max-width: 100vw;
    min-height: 0;
    overflow: hidden;
}

/* Report exports stay available on desktop and are hidden on mobile in both orientations. */
.sg-mobile .agro-activities-page #activity-reports-export-btn,
.sg-mobile .agro-activities-page #agro-reports-export-btn {
    display: none !important;
}
.sg-mobile.sg-app-shell {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 100vw;
    min-height: 0;
    overflow: hidden;
}
.sg-mobile .sg-header-navbar {
    position: relative;
    top: auto;
    z-index: 1000;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    box-sizing: border-box;
}
.sg-mobile #sidebar-container {
    position: fixed !important;
    inset: 0 auto 0 0;
    z-index: 50002;
    width: min(78vw, 300px);
    min-width: 0;
    max-width: 300px;
    height: 100dvh;
    max-height: 100dvh;
    flex: 0 0 auto;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease-out;
    background: #f7f8ef;
    box-shadow: 3px 0 18px rgba(13, 32, 24, 0.2);
    border-right: 1px solid #cbd6cd;
}
.sg-mobile #sidebar-container.mobile-open {
    transform: translateX(0);
}
.sg-mobile .sg-sidebar-header {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    height: 56px;
    padding: 8px 12px;
    border-bottom: 1px solid #d8e0d9;
}
.sg-mobile .sg-sidebar-header #sidebar-toggle,
.sg-mobile .sg-sidebar-header hr {
    display: none !important;
}
.sg-mobile .sg-mobile-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d9e2dc;
    border-radius: 10px;
    color: #244b36;
    background: #fff;
}
.sg-mobile .sg-mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50001;
    width: 100vw;
    height: 100dvh;
    padding: 0;
    border: 0;
    background: rgba(14, 24, 19, 0.42);
}
.sg-mobile .sg-mobile-nav-backdrop[style*="display: block"] {
    display: block !important;
}
.sg-mobile .sg-sidebar-nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    padding: 8px;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    white-space: normal;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: thin;
}
.sg-mobile #sidebar-nav > a {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    min-height: 52px;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    white-space: normal;
}
.sg-mobile #sidebar-nav > a span:last-child {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.25;
}
.sg-mobile .sg-sidebar-nav a {
    flex: 0 0 auto;
    gap: 0.4rem;
    font-size: 0.95rem;
}
.sg-mobile .sg-sidebar-nav .sg-sidebar-icon { width: 24px; height: 24px; }
.sg-mobile .sg-mobile-nav-toggle {
    display: inline-flex !important;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #d8e2dc;
    border-radius: 10px;
    color: #244b36;
    background: #fff;
    margin-left: 0;
}
.sg-mobile .sg-mobile-alerts-toggle,
.sg-mobile .sg-mobile-statistics-toggle {
    display: inline-flex !important;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #d8e2dc;
    border-radius: 10px;
    color: #244b36;
    background: #fff;
    margin-left: 0;
}
.sg-mobile .sg-mobile-alerts-toggle .sg-icon { width: 22px; height: 22px; }
.sg-mobile .sg-mobile-statistics-toggle .bi { font-size: 1.2rem; }
.sg-mobile .sg-mobile-nav-toggle .bi { font-size: 1.25rem; }
.sg-mobile .sg-header-navbar { padding: 0.1rem 0; }
.sg-mobile .sg-header-navbar .container-fluid {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    gap: 0.3rem;
    padding: 0.25rem 0.45rem !important;
}
.sg-mobile .sg-header-navbar .container-fluid > .d-flex.align-items-center {
    flex: 1 1 0;
    min-width: 0;
}
.sg-mobile .sg-header-navbar .container-fluid > .d-flex.align-items-center > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.sg-mobile .sg-header-navbar .container-fluid > .d-flex.align-items-center > div:first-child > div {
    min-width: 0;
    overflow: hidden;
}
.sg-mobile .sg-header-navbar .container-fluid > .d-flex.align-items-center > div:last-child {
    display: none !important;
}
.sg-mobile .sg-header-navbar .sg-logo { width: 32px; height: 32px; margin-right: 0.25rem !important; object-fit: contain; flex: 0 0 32px; }
.sg-mobile .sg-company-name {
    display: block;
    max-width: clamp(76px, 25vw, 112px);
    overflow: hidden;
    font-size: clamp(0.95rem, 4.6vw, 1.15rem);
    line-height: 1.1;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.sg-mobile .sg-global-actions-row {
    position: relative;
    display: flex;
    order: 2;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    gap: 0.25rem;
    padding: 0;
}
.sg-mobile .sg-mobile-filters-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #d6e1da;
    border-radius: 10px;
    color: #176b50;
    background: #fff;
    font-size: 1.1rem;
}
.sg-mobile .sg-mobile-filters-panel {
    display: none;
    position: absolute;
    z-index: 20000;
    top: calc(100% + 8px);
    right: 0;
    width: min(94vw, 420px);
    padding: 12px;
    border: 1px solid #d6e1da;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(20, 45, 33, 0.22);
    gap: 8px;
}
.sg-mobile .sg-mobile-filters-panel[style*="display: grid"] { display: grid !important; }
.sg-mobile .sg-global-actions-row .sg-mobile-essential-filter {
    grid-template-columns: 92px minmax(0, 1fr);
}
.sg-mobile .sg-global-actions-row .sg-mobile-secondary-filter { display: none; }
.sg-mobile .sg-mobile-filters-panel .sg-global-filter-control {
    background-color: #f8faf9;
}
.sg-mobile .sg-global-actions-row .sg-mobile-essential-filter {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.sg-mobile .sg-global-actions-row .sg-mobile-secondary-filter { display: none; }
.sg-mobile .sg-global-actions-row .sg-global-filter-label {
    white-space: normal;
    font-size: 0.75rem;
    line-height: 1.2;
}
.sg-mobile .sg-global-actions-row .sg-global-filter-control {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    height: auto;
    padding: 4px 8px;
    border-radius: 10px;
}
.sg-mobile .sg-global-actions-row .sg-global-filter-trigger { flex: 0 0 32px; min-height: 34px; }
.sg-mobile .sg-global-actions-row .sg-global-filter-control .sg-plant-filter-dropdown {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown,
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .Select,
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .dash-dropdown,
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .Select-control {
    box-sizing: border-box;
    flex: 1 1 0;
    width: 100% !important;
    min-width: 0 !important;
}
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .Select-control,
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .dash-dropdown .Select-control {
    min-width: 0;
    width: 100%;
}
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .Select-menu-outer {
    left: 0;
    right: 0;
    z-index: 30001;
    width: 100% !important;
    min-width: 100% !important;
    max-width: calc(100vw - 130px);
}
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .Select-menu {
    max-height: 45vh;
    overflow-y: auto;
}
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .VirtualizedSelectOption,
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown .VirtualizedSelectFocusedOption {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.sg-mobile .sg-global-actions-row .sg-plant-filter-dropdown { display: none !important; }
.sg-mobile .sg-global-actions-row .sg-mobile-plant-filter-native {
    display: block !important;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    border: 0;
    box-shadow: none;
    background-color: transparent;
}
.sg-mobile .sg-global-actions-row .sg-global-filter-value {
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: 0.78rem;
    line-height: 1.2;
}
.sg-mobile .sg-mobile-filters-toggle { display: inline-flex !important; }
.sg-mobile .sg-mobile-filters-panel {
    display: none;
    position: absolute;
    z-index: 20000;
    top: calc(100% + 8px);
    right: 0;
    width: min(94vw, 420px);
    padding: 12px;
    border: 1px solid #d6e1da;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(20, 45, 33, 0.22);
    gap: 8px;
}
.sg-mobile .sg-mobile-filters-panel[style*="display: grid"] { display: grid !important; }
.sg-mobile #user-menu { flex: 0 0 auto; padding-right: 0 !important; }
.sg-mobile #user-menu .dropdown-toggle {
    max-width: clamp(88px, 27vw, 112px);
    min-height: 38px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.45rem;
    font-size: 0.82rem;
}
.sg-mobile .sg-company-tagline { display: none; }
.sg-mobile .sg-current-page { display: none !important; }
.sg-mobile .sg-main-content {
    display: block;
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}
.sg-mobile #page-content {
    display: block;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow: visible;
}
.sg-mobile .ps-mobile-layout { padding: 8px 8px 72px !important; max-height: none !important; }
.sg-mobile .ps-mobile-layout .row {
    width: 100%;
    margin-inline: 0 !important;
    --bs-gutter-x: 0.5rem;
}
.sg-mobile .ps-mobile-layout,
.sg-mobile .ps-mobile-layout .row,
.sg-mobile .ps-mobile-layout .row > *,
.sg-mobile .ps-mobile-layout .col,
.sg-mobile .ps-mobile-layout .ps-farm-card,
.sg-mobile .ps-mobile-layout .ps-farm-chart,
.sg-mobile .ps-mobile-layout .ps-farm-card > .card-body,
.sg-mobile .ps-mobile-layout .dash-graph,
.sg-mobile .ps-mobile-layout .js-plotly-plot,
.sg-mobile .ps-mobile-layout .plot-container,
.sg-mobile .ps-mobile-layout .svg-container {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}
.sg-mobile .ps-mobile-layout { width: 100%; }
.sg-mobile .ps-mobile-layout .ps-farm-chart,
.sg-mobile .ps-mobile-layout .dash-graph,
.sg-mobile .ps-mobile-layout .js-plotly-plot,
.sg-mobile .ps-mobile-layout .plot-container,
.sg-mobile .ps-mobile-layout .svg-container { width: 100% !important; }
.sg-mobile .ps-mobile-layout .ps-customer-toolbar { align-items: stretch !important; }
.sg-mobile .ps-mobile-layout .ps-customer-toolbar > div { width: 100%; }
.sg-mobile .ps-mobile-layout .ps-customer-toolbar .Select-control { min-height: 44px; }
.sg-mobile .ps-mobile-layout .ps-farm-card { border-radius: 12px; overflow: hidden; }
.sg-mobile .ps-mobile-layout .ps-farm-header { padding: 12px; }
.sg-mobile .ps-mobile-layout .ps-farm-header > div { align-items: center !important; flex-wrap: nowrap; gap: 8px; }
.sg-mobile .ps-mobile-layout :is(.ps-farm-header, .ps-unit-header) > div > div:first-child {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
}
.sg-mobile .ps-mobile-layout :is(.ps-farm-name, .ps-unit-name) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.sg-mobile .ps-mobile-layout :is(.ps-farm-header, .ps-unit-header) > div > div:last-child {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 12px;
}
.sg-mobile .ps-mobile-layout .ps-unit-header > div { flex-wrap: nowrap; gap: 6px; }
.sg-mobile .ps-mobile-layout .ps-farm-header [id] { margin-left: 0 !important; min-height: 44px; }
.sg-mobile .ps-mobile-layout .ps-farm-card > .card-body { padding: 4px 8px 10px; }
.sg-mobile .ps-mobile-layout .ps-farm-chart { width: 100%; }
.sg-mobile .ps-mobile-layout .ps-unit-card { margin-bottom: 8px; }
.sg-mobile .ps-mobile-layout .ps-info-table { table-layout: auto !important; }
.sg-mobile .ps-mobile-layout .ps-info-table td { white-space: normal !important; overflow-wrap: anywhere; }
.sg-mobile .ps-mobile-layout .ps-info-table td:nth-child(2) { width: 35% !important; }
.sg-mobile .ps-mobile-layout .ps-info-table td:nth-child(3) { width: auto; }
.sg-mobile .ps-modal { max-width: calc(100vw - 20px); margin: 10px auto; }
.sg-mobile .ps-modal .modal-body { overflow-x: auto; }

/* In phone landscape, let every farm card use the full row so its plots have room. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1200px) and (pointer: coarse) {
    .sg-mobile .ps-mobile-layout #plot-status-farm-grid > .row > [class*="col-"] {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

.sg-mobile .irrigation-tracker-mobile {
    display: block;
    height: auto;
    min-height: 100%;
    overflow: visible;
    padding-bottom: 20px;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-navbar {
    position: static !important;
    padding: 8px 10px;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 7px;
}
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-section {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
}
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-section-label {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.2;
}
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-section .form-select {
    width: 100% !important;
    min-width: 0;
    min-height: 40px;
    font-size: 0.88rem;
}
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-pill {
    max-width: 100%;
    min-width: 0;
    padding: 0.35rem 0.5rem;
}
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-pill .form-check-inline {
    margin: 0.15rem 0.6rem 0.15rem 0;
}
.sg-mobile .irrigation-tracker-mobile #irrigation-tracker-export-csv { display: none !important; }
.sg-mobile .irrigation-tracker-mobile .sg-page-content-no-data {
    margin: 0 8px;
    padding: 14px;
    border: 1px solid var(--sg-border, #dce7df);
    border-radius: 10px;
    background: #fff;
    font-size: 0.95rem;
}

/* Tracker filters: consistent left labels, aligned 42px controls and balanced columns. */
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    align-items: stretch;
    gap: 8px;
    width: 100%;
    min-width: 0;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row > .agro-toolbar-section {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    width: auto;
    min-width: 0;
    min-height: 60px;
    padding: 8px;
    border: 1px solid #d7e1da;
    border-radius: 9px;
    background: #fff;
}
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-section-label {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.2;
    text-align: left;
    justify-self: start;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row .agro-toolbar-section-label {
    font-size: 0.66rem;
    font-weight: 700;
    white-space: nowrap;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-plant-units-section .sg-btns {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    justify-self: end;
    padding: 0 !important;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-type-section .agro-toolbar-pill,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-type-section .form-select {
    width: 100% !important;
    min-width: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0;
    text-align: left;
}
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-section .form-select,
.sg-mobile .irrigation-tracker-mobile .agro-toolbar-section .form-check-label {
    text-align: left;
}

/* Plant-unit modal is rendered in a portal, so scope this small-screen fix by ID. */
 .sg-mobile .agro-activities-body .activity-diary-excel-actions {
    display: none !important;
}

@media (max-width: 600px) {
    /* Dash can portal Select menus outside the filter row, so size them globally. */
    .Select-menu-outer {
        z-index: 30001 !important;
        width: min(58vw, 240px) !important;
        min-width: min(58vw, 240px) !important;
        max-width: calc(100vw - 140px) !important;
        overflow-x: hidden;
    }
    .Select-menu { max-height: 45vh; overflow-y: auto; }
    .VirtualizedSelectOption,
    .VirtualizedSelectFocusedOption {
        white-space: normal !important;
        overflow-wrap: anywhere;
        line-height: 1.25;
    }
    #global-time-filter-selected-range-label:empty::before { content: "1W"; }
    #generic-modal-plant-unit-filter .modal-dialog,
    #generic-modal-plant-unit-filter.modal-dialog,
    #generic-modal-time-frame-filter .modal-dialog,
    #generic-modal-time-frame-filter.modal-dialog {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        margin: 12px auto !important;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection .modal-dialog {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        margin: 12px auto !important;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection.modal-dialog {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        margin: 12px auto !important;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection .modal-content {
        max-height: calc(100dvh - 24px);
        overflow: hidden;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection .modal-header {
        align-items: center;
        padding: 12px;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection .modal-body {
        min-width: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 12px;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection #irrigation-tracker-plant-unit-selection-checklist label {
        width: 100%;
        min-width: 0;
        align-items: flex-start !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        line-height: 1.35;
        padding: 6px 0;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection #irrigation-tracker-plant-unit-selection-checklist label > span {
        min-width: 0;
        max-width: 100%;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection #irrigation-tracker-plant-unit-selection-checklist input {
        flex: 0 0 auto;
        margin: 3px 8px 0 2px !important;
    }
    #generic-modal-irrigation-tracker-plant-unit-selection .modal-footer {
        gap: 8px;
        padding: 12px;
    }
}
.sg-mobile .irrigation-tracker-mobile #irrigation-tracker-total-irrigation-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 8px;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-body {
    height: auto;
    overflow: visible;
    padding: 0 6px 14px !important;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-graphs-stack { height: auto; overflow: visible; }
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-graph-wrap,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-compare-card { margin-bottom: 8px; }
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-graph-wrap .js-plotly-plot,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-compare-card .js-plotly-plot { width: 100%; }
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-graph-wrap {
    flex: 0 0 auto;
    min-height: 250px;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-graph-wrap .js-plotly-plot,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-graph-wrap .plot-container,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-graph-wrap .svg-container {
    height: 100% !important;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-mobile-row,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-col {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto !important;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-div {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    height: auto !important;
    min-height: 330px;
    margin: 0;
    align-items: stretch;
    justify-content: flex-start;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-head {
    min-height: 48px;
    height: auto;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 10px;
    font-size: 0.9rem !important;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-statistics {
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    justify-content: stretch;
    padding: 8px;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-statistics-item {
    width: auto;
    min-width: 0;
    min-height: 56px;
    height: auto;
    margin: 0;
    gap: 2px;
    padding: 6px !important;
    text-align: center;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-statistics-item-title {
    font-size: 0.65rem !important;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-statistics-item-value {
    font-size: 0.95rem !important;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-hist-title {
    min-height: 28px;
    height: auto;
    padding: 4px 8px;
    font-size: 0.7rem !important;
    text-align: center;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-hist {
    height: 220px;
    min-height: 220px;
    flex: 0 0 220px;
}
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-hist .js-plotly-plot,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-hist .plot-container,
.sg-mobile .irrigation-tracker-mobile .irrigation-tracker-statistics-unit-hist .svg-container {
    height: 100% !important;
    width: 100% !important;
}

/* Irrigation recommendations: keep controls and unit plans usable on phones. */
.sg-mobile .irrigation-recommendation-mobile {
    height: auto !important;
    min-height: 100dvh;
    overflow: visible !important;
    padding-bottom: 16px !important;
}
.sg-mobile .irrigation-recommendation-mobile .irrigation-recommendation-header {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    overflow: visible !important;
    padding: 6px 8px !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-header-row {
    height: auto !important;
    min-width: 0 !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-header-row > .ir-header-col {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-header-row > .ir-info-col,
.sg-mobile .irrigation-recommendation-mobile .ir-header-row > .ir-operations-col {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-header-row > .ir-operations-col {
    order: -1;
}
.sg-mobile .irrigation-recommendation-mobile .ir-chart-card {
    height: 190px !important;
    min-height: 190px;
}
.sg-mobile .irrigation-recommendation-mobile .ir-info-card,
.sg-mobile .irrigation-recommendation-mobile .ir-operations-card {
    height: auto !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-operations-card .ir-operations-stack {
    min-height: 0;
    gap: 8px !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-operations-card .ir-days-group {
    margin-top: 0;
    padding-bottom: 8px;
}
.sg-mobile .irrigation-recommendation-mobile #irrigation-recommendation-export-btn {
    display: none !important;
}
.sg-mobile .irrigation-recommendation-mobile .irrigation-recommendation-plant-units-body {
    height: auto !important;
    flex: 0 0 auto;
    overflow: visible !important;
    padding: 4px 6px 12px !important;
}
.sg-mobile .irrigation-recommendation-mobile .irrigation-recommendation-plant-units-body > .row {
    height: auto !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card {
    height: 390px !important;
    min-height: 390px;
    margin-bottom: 10px;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-header .ir-unit-identity {
    flex-basis: 100%;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-header .ir-unit-plan-actions {
    width: 100%;
    justify-content: flex-end;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card .modebar {
    display: none !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card .ir-day-card {
    min-width: min(82vw, 320px);
}
.sg-mobile .irrigation-recommendation-mobile .ir-overview-card {
    height: auto !important;
    min-height: 0;
}
.sg-mobile .irrigation-recommendation-mobile .ir-overview-body {
    flex: 0 0 auto !important;
    min-height: 0;
}
.sg-mobile .irrigation-recommendation-mobile .ir-overview-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: thin;
}
.sg-mobile .irrigation-recommendation-mobile .ir-overview-scroll > .dash-graph {
    flex: 0 0 auto;
}
.sg-mobile .irrigation-recommendation-mobile .ir-overview-card .modebar {
    display: none !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card {
    height: 380px !important;
    min-height: 380px;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card .ir-unit-header {
    display: grid !important;
    direction: ltr;
    grid-template-columns: 20px 15px minmax(0, 1fr) 32px 32px 32px;
    grid-template-rows: auto auto 32px;
    align-items: center !important;
    column-gap: 6px;
    row-gap: 5px;
    min-height: 0;
    padding: 6px 8px !important;
    line-height: 1.25;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-header .ir-unit-identity {
    display: contents !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-header .ir-unit-identity > img {
    width: 22px;
    height: 22px;
    margin: 0 !important;
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-header .ir-unit-identity > div:not(.ir-unit-description-wrap) {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-description-wrap {
    min-width: 0;
    grid-column: 3 / 7;
    grid-row: 1 / 3;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-description {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 6px;
    row-gap: 4px;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-description .ir-unit-name {
    grid-column: 1;
    grid-row: 1;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-description .ir-unit-location {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-description .ir-unit-metadata {
    grid-column: 1 / 3;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-name {
    font-size: 15px !important;
    line-height: 1.2;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-location,
.sg-mobile .irrigation-recommendation-mobile .ir-unit-metadata {
    font-size: 10px !important;
    line-height: 1.2;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-header .ir-unit-action {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-header .ir-unit-plan-actions {
    display: contents !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-plan-actions > .form-check {
    display: contents !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-plan-actions > .form-check .form-check-input {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    align-self: center;
    flex: 0 0 auto;
    margin: 0 !important;
    float: none;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-plan-actions > .form-check .form-check-label {
    grid-column: 2 / 4;
    grid-row: 3;
    justify-self: start;
    align-self: center;
    min-width: 0;
    margin: 0 !important;
    line-height: 1.2;
    text-align: start;
    white-space: nowrap;
    font-size: 11px;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-plan-actions > .ir-unit-action {
    grid-column: 6;
    grid-row: 3;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-identity > .ir-unit-action:nth-of-type(1) {
    grid-column: 4;
    grid-row: 3;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-identity > .ir-unit-action:nth-of-type(2) {
    grid-column: 5;
    grid-row: 3;
}
.sg-mobile:dir(rtl) .irrigation-recommendation-mobile .ir-unit-description-wrap,
.sg-mobile:dir(rtl) .irrigation-recommendation-mobile .ir-unit-plan-actions > .form-check .form-check-label {
    direction: rtl;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card > .card-body {
    min-height: 0;
    overflow: hidden;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card > .card-body > div {
    width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scrollbar-width: thin;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card > .card-body > div > .row {
    width: max-content;
    min-width: 100%;
    flex-wrap: nowrap !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card > .card-body > div > .row > * {
    width: 84vw !important;
    max-width: 84vw !important;
    min-width: 84vw !important;
    flex: 0 0 84vw !important;
    height: 100% !important;
}
.sg-mobile .irrigation-recommendation-mobile .ir-unit-card .ir-day-card {
    width: 100%;
    min-width: 0;
    height: 100%;
}

/* Agro Insights mobile layout. */
.sg-mobile .agro-insights-navbar {
    position: static !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 8px 10px 5px;
    border: 1px solid #d9e4dd;
    border-radius: 0 0 14px 14px;
    background: #f2f7f4 !important;
    box-shadow: 0 2px 8px rgba(28, 58, 40, 0.08);
}
.sg-mobile .agro-insights-navbar .agro-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    width: 100%;
    min-width: 0;
    gap: 8px 10px;
    padding: 4px 0;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-divider { display: none; }
.sg-mobile .agro-insights-navbar .agro-show-section,
.sg-mobile .agro-insights-navbar .agro-options-section,
.sg-mobile .agro-insights-navbar .agro-hover-width-row {
    grid-column: 1 / -1;
}
.sg-mobile .agro-insights-navbar .agro-actions-section {
    grid-column: 1;
    align-self: stretch;
}
.sg-mobile .agro-insights-navbar .agro-irrigation-toggle {
    grid-column: 2;
    align-self: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 8px;
    border: 1px solid #d7e1da;
    border-radius: 10px;
    background: #fff;
    color: #405b4b;
    font-size: 0.82rem;
    white-space: nowrap;
    box-sizing: border-box;
}
.sg-mobile .agro-insights-navbar .agro-hover-width-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    min-width: 0;
}
.sg-mobile .agro-insights-navbar .agro-hover-width-row > .agro-toolbar-section {
    width: 100%;
    min-width: 0;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-section {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    width: 100%;
    min-width: 0;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-section-label {
    margin: 0;
    padding-inline: 2px;
    color: #456653;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-section > .agro-toolbar-pill,
.sg-mobile .agro-insights-navbar .agro-toolbar-section > .agro-action-btn-group {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-pill {
    height: auto;
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid #d5e0d9;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(25, 65, 40, 0.04);
}
.sg-mobile .agro-insights-navbar .agro-show-checklist {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: center;
    grid-auto-flow: row;
    grid-auto-rows: minmax(36px, auto);
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    gap: 3px 8px;
}
.sg-mobile .agro-insights-navbar .agro-show-checklist > .form-check:nth-child(-n+3) { grid-row: 1; }
.sg-mobile .agro-insights-navbar .agro-show-checklist > .form-check:nth-child(n+4) { grid-row: 2; }
.sg-mobile .agro-insights-navbar .agro-toolbar-switch-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    gap: 2px 10px;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-checklist .form-check,
.sg-mobile .agro-insights-navbar .agro-show-checklist .form-check {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 32px;
    margin: 0;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-checklist .form-check-label,
.sg-mobile .agro-insights-navbar .agro-show-checklist .form-check-label {
    min-width: 0;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-checklist .form-check-input,
.sg-mobile .agro-insights-navbar .agro-show-checklist .form-check-input {
    flex: 0 0 auto;
    margin: 0 6px 0 0;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-hover-pill {
    padding: 0 4px;
    overflow: visible;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-hover-pill .agro-toolbar-dropdown,
.sg-mobile .agro-insights-navbar .agro-toolbar-hover-pill .Select {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-hover-pill .Select-control {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    box-sizing: border-box;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-hover-pill .Select-value {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 6px;
    right: 30px;
    display: flex;
    align-items: center;
    width: auto;
    height: auto;
    padding: 0;
    line-height: 1.2;
    white-space: normal;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-hover-pill .Select-value-label {
    display: block;
    overflow: visible;
    line-height: 1.2;
    white-space: normal !important;
    text-overflow: clip;
    overflow-wrap: anywhere;
}
.sg-mobile .agro-insights-navbar .agro-hover-width-row {
    grid-template-columns: minmax(0, 1.4fr) minmax(108px, 0.8fr);
}
.sg-mobile .agro-insights-navbar .agro-hover-width-row > .agro-toolbar-section {
    height: 66px;
    min-height: 66px;
    box-sizing: border-box;
}
.sg-mobile .agro-insights-navbar .agro-hover-width-row .agro-toolbar-section > .agro-toolbar-pill {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}
.sg-mobile .agro-insights-navbar #agro-bar-width-multiplier {
    width: 100% !important;
    min-width: 0;
    height: 100%;
    min-height: 44px;
    box-sizing: border-box;
    border-radius: 9px;
    text-align: center;
}
.sg-mobile .agro-insights-navbar .agro-actions-section,
.sg-mobile .agro-insights-navbar .agro-irrigation-toggle {
    height: 66px;
    min-height: 66px;
    box-sizing: border-box;
}
.sg-mobile .agro-insights-navbar .agro-actions-section {
    padding: 7px 10px;
    border: 1px solid #d5e0d9;
    border-radius: 10px;
    background: #fff;
}
.sg-mobile .agro-insights-navbar .agro-actions-section .agro-action-btn-group {
    flex: 1 1 auto;
    align-items: center;
}
.sg-mobile .agro-insights-navbar .agro-action-btn-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.sg-mobile .agro-insights-navbar .agro-action-btn-group .sg-btns {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    min-height: 44px !important;
    flex: 0 0 44px;
}
.sg-mobile .agro-insights-navbar #agro-export-btn {
    display: none !important;
}

/* Compact controls: labels above a single 44px interaction row. */
.sg-mobile .agro-insights-navbar .agro-toolbar-switch-group {
    height: auto;
    padding: 8px 10px;
    gap: 6px 10px !important;
}
.sg-mobile .agro-insights-navbar .agro-toolbar-hover-pill,
.sg-mobile .agro-insights-navbar .agro-toolbar-bar-width-pill {
    display: flex;
    align-items: center;
    padding: 0;
    height: 44px !important;
    min-height: 44px !important;
    border: 0;
    box-shadow: none;
    overflow: visible;
}
.sg-mobile .agro-insights-navbar #agro-hover-mode-dropdown,
.sg-mobile .agro-insights-navbar #agro-hover-mode-dropdown > div,
.sg-mobile .agro-insights-navbar #agro-hover-mode-dropdown .Select,
.sg-mobile .agro-insights-navbar #agro-hover-mode-dropdown .Select-control {
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
}
.sg-mobile .agro-insights-navbar #agro-hover-mode-dropdown .Select-control {
    display: table;
    table-layout: fixed;
    height: 44px !important;
}
.sg-mobile .agro-insights-navbar #agro-bar-width-multiplier {
    height: 44px !important;
}
.sg-mobile .agro-insights-navbar .agro-actions-section {
    padding: 0;
    border: 0;
    background: transparent;
}
.sg-mobile .agro-insights-navbar .agro-actions-section .agro-action-btn-group {
    flex: 0 0 44px;
}
.sg-mobile .agro-insights-navbar .agro-irrigation-toggle {
    align-self: end;
    height: 44px;
    min-height: 44px;
    white-space: normal;
    line-height: 1.2;
}

@media (orientation: landscape) {
    .sg-mobile .agro-insights-navbar .agro-toolbar {
        gap: 6px 10px;
        padding: 2px 0;
    }
    .sg-mobile .agro-insights-navbar .agro-show-section,
    .sg-mobile .agro-insights-navbar .agro-options-section {
        grid-column: auto;
    }
    .sg-mobile .agro-insights-navbar .agro-show-checklist {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    .sg-mobile .agro-insights-navbar .agro-toolbar-switch-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .sg-mobile .agro-insights-navbar .agro-toolbar-section {
        width: 100%;
        min-width: 0;
    }
    .sg-mobile .agro-insights-navbar .agro-hover-width-row {
        grid-column: 1 / -1;
    }
}
.sg-mobile .agro-body {
    height: auto !important;
    min-height: 0;
    padding: 6px 6px 16px !important;
}
.sg-mobile .agro-graphs-stack {
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
    gap: 10px;
}
.sg-mobile .agro-graph-wrap {
    width: 100%;
    height: 55dvh;
    min-height: 340px;
    max-height: 520px;
    flex: 0 0 auto !important;
}
.sg-mobile .agro-graph-wrap.agro-expanded-view {
    height: 65dvh;
    min-height: 380px;
    max-height: 620px;
    flex-basis: auto !important;
}
.sg-mobile .agro-graph-wrap > .dash-graph,
.sg-mobile .agro-graph-wrap .js-plotly-plot,
.sg-mobile .agro-graph-wrap .plot-container,
.sg-mobile .agro-graph-wrap .svg-container {
    width: 100% !important;
    height: 100% !important;
}
.sg-mobile .agro-graph-wrap .agro-view-controls {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 100%;
    height: 36px;
    margin: 0 0 4px;
    padding: 0 4px;
    justify-content: flex-end;
    justify-content: safe flex-end;
    box-sizing: border-box;
    overflow-x: auto;
}
.sg-mobile .agro-graph-wrap > .dash-graph {
    height: calc(100% - 40px) !important;
}
.sg-mobile .agro-empty-view .agro-view-controls {
    display: none;
}
.sg-mobile .agro-empty-view > .dash-graph {
    height: 100% !important;
}

/* Monitor Viewer mobile layout: swipe through tabs and wide tables. */
.sg-mobile .monitor-viewer-page {
    width: 100%;
    min-width: 0;
    padding: 8px 6px 16px !important;
    overflow-x: hidden;
}
.sg-mobile .monitor-viewer-page .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}
.sg-mobile .monitor-viewer-page .nav-tabs .nav-item {
    flex: 0 0 auto;
}
.sg-mobile .monitor-viewer-page .nav-tabs .nav-link {
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
}
.sg-mobile .monitor-viewer-page .monitor-quick-controls {
    flex-wrap: wrap;
    align-items: stretch !important;
    padding: 8px !important;
    gap: 8px !important;
}
.sg-mobile .monitor-viewer-page .monitor-counts {
    flex: 1 1 100%;
    gap: 6px !important;
}
.sg-mobile .monitor-viewer-page .monitor-count-button {
    min-height: 40px;
    padding: 6px 8px !important;
    font-size: 0.78rem !important;
}
.sg-mobile .monitor-viewer-page .monitor-issues-switch {
    min-height: 40px;
}
.sg-mobile .monitor-viewer-page :is(#controllers-table, #measurements-table, #algorithm-results-table) {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    max-height: 58vh !important;
    min-height: 220px !important;
    overflow: auto !important;
}
.sg-mobile .monitor-viewer-page :is(#controllers-table, #measurements-table, #algorithm-results-table) .dash-spreadsheet-container {
    max-height: 58vh !important;
    overflow: auto !important;
}
.sg-mobile .monitor-viewer-page .dash-table-container {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.sg-mobile .monitor-viewer-page .dash-table-container .dash-spreadsheet-inner td,
.sg-mobile .monitor-viewer-page .dash-table-container .dash-spreadsheet-inner th {
    font-size: 0.76rem !important;
    padding: 6px 7px !important;
}
.sg-mobile .monitor-viewer-page .card-body {
    min-width: 0;
    padding: 0.65rem;
}
.sg-mobile .monitor-viewer-page .row {
    min-width: 0;
}
.sg-mobile .monitor-viewer-page .js-plotly-plot,
.sg-mobile .monitor-viewer-page .dash-graph {
    max-width: 100%;
}

/* In landscape, show the active page in the header even when the browser asks
   the server for the desktop version (which omits the sg-mobile shell class). */
@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) and (hover: none) {
    #shell-view .sg-current-page {
        display: none !important;
    }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 950px) and (pointer: coarse) and (hover: none) {
    #shell-view .sg-header-navbar .container-fluid > .d-flex.align-items-center {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
    }

    #shell-view .sg-header-navbar .container-fluid > .d-flex.align-items-center > .sg-current-page {
        display: flex !important;
        flex: 1 1 auto;
        min-width: 0;
        margin-left: 0.4rem !important;
        gap: 0.3rem !important;
        overflow: hidden;
    }

    #shell-view #current-page-icon {
        display: inline-flex;
        flex: 0 0 28px;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        margin: 0 !important;
    }

    #shell-view #current-page-icon img {
        width: 28px;
        height: 28px;
        object-fit: contain;
    }

    #shell-view #current-page-title {
        min-width: 0;
        overflow: hidden;
        font-size: clamp(0.85rem, 2.4vw, 1.05rem);
        line-height: 1.15;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
}

/* Satellite uses desktop map grids; stack the same views and controls on phones. */
@media (max-width: 600px) {
    .sg-mobile .satellite-page {
        height: auto !important;
        min-height: 0 !important;
        padding: 0.85rem 0.35rem 0.5rem !important;
        overflow: visible;
    }

    .sg-mobile .satellite-page .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
    }

    .sg-mobile .satellite-page .tab-content,
    .sg-mobile .satellite-page .tab-pane,
    .sg-mobile .satellite-page .tab-pane.active {
        height: auto !important;
        overflow: visible;
    }

    .sg-mobile .satellite-page .tab-pane > .card {
        margin-top: 0.5rem !important;
    }

    .sg-mobile .satellite-page .tab-pane > .card > .card-body {
        height: auto !important;
        padding: 0.5rem !important;
    }

    .sg-mobile .satellite-view-layout,
    .sg-mobile .satellite-et-layout,
    .sg-mobile .satellite-config-layout {
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        flex: 0 0 auto !important;
        padding: 0.25rem 0.15rem 0.5rem !important;
    }

    .sg-mobile .satellite-page .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .sg-mobile .satellite-active-unit-list {
        width: 100%;
    }

    .sg-mobile .satellite-dashboard {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        grid-template-rows: minmax(260px, 42vh) minmax(260px, 42vh) minmax(190px, auto) minmax(260px, auto) !important;
        grid-template-areas: "stress" "detail" "stats" "graph" !important;
        height: auto !important;
        min-height: 0 !important;
        flex: 0 0 auto !important;
    }

    .sg-mobile .satellite-dashboard-et {
        grid-template-rows: minmax(280px, 44vh) minmax(260px, auto) !important;
        grid-template-areas: "map" "graph" !important;
    }

    .sg-mobile .satellite-card {
        width: 100%;
        min-width: 0;
    }

    .sg-mobile .satellite-card .leaflet-container,
    .sg-mobile .satellite-card .dash-graph,
    .sg-mobile .satellite-card .js-plotly-plot,
    .sg-mobile .satellite-card .plot-container,
    .sg-mobile .satellite-card .svg-container {
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .sg-mobile .satellite-card .satellite-map-legend {
        right: 6px;
        bottom: 20px;
        width: clamp(104px, 30vw, 128px);
        max-width: calc(100% - 52px);
        max-height: calc(100% - 48px);
        padding: 7px;
    }

    .sg-mobile .satellite-card .satellite-legend-title {
        margin-bottom: 5px;
        font-size: 10px;
        line-height: 1.2;
    }

    .sg-mobile .satellite-card .satellite-legend-body {
        height: clamp(72px, 22vw, 90px);
        gap: 6px;
    }

    .sg-mobile .satellite-card .satellite-legend-image {
        flex-basis: 9px;
        width: 9px;
    }

    .sg-mobile .satellite-card .satellite-legend-labels {
        font-size: 9px;
        line-height: 1.15;
    }

    .sg-mobile .satellite-card .satellite-map-legend.is-discrete {
        width: clamp(122px, 36vw, 150px);
    }

    .sg-mobile .satellite-card .satellite-map-legend.is-discrete .satellite-legend-labels {
        gap: 5px;
    }

    .sg-mobile .satellite-config-layout > .flex-grow-1 {
        flex: 0 0 56vh !important;
        height: 56vh;
        min-height: 300px !important;
    }

    .sg-mobile .satellite-config-layout .d-flex {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
}

/* Keep both maps useful in phone landscape without clipping the statistics or chart. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 950px) and (pointer: coarse) and (hover: none) {
    .sg-mobile .satellite-page {
        height: auto !important;
        min-height: 0 !important;
        padding: 0.35rem 0.5rem !important;
        overflow: visible !important;
    }

    .sg-mobile .satellite-page .tab-content,
    .sg-mobile .satellite-page .tab-pane,
    .sg-mobile .satellite-page .tab-pane.active {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .sg-mobile .satellite-page .tab-pane > .card,
    .sg-mobile .satellite-page .tab-pane > .card > .card-body {
        height: auto !important;
        min-height: 0 !important;
    }

    .sg-mobile .satellite-view-layout,
    .sg-mobile .satellite-et-layout,
    .sg-mobile .satellite-config-layout {
        height: auto !important;
        min-height: 0 !important;
        flex: 0 0 auto !important;
        overflow: visible !important;
    }

    .sg-mobile .satellite-dashboard {
        width: 100%;
        min-width: 0;
        flex: 0 0 auto !important;
        overflow: visible;
    }

    .sg-mobile .satellite-dashboard {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-template-rows: minmax(220px, 55vh) minmax(170px, auto) minmax(220px, 55vh) !important;
        grid-template-areas: "stress detail" "stats stats" "graph graph" !important;
        gap: 8px !important;
    }

    .sg-mobile .satellite-dashboard-et {
        grid-template-rows: minmax(260px, 70vh) !important;
        grid-template-areas: "map graph" !important;
    }

    .sg-mobile .satellite-card .satellite-map-legend {
        right: 6px;
        bottom: 20px;
        width: clamp(104px, 30vw, 128px);
        max-width: calc(100% - 52px);
        max-height: calc(100% - 48px);
        padding: 7px;
    }

    .sg-mobile .satellite-card .satellite-legend-title {
        margin-bottom: 5px;
        font-size: 10px;
        line-height: 1.2;
    }

    .sg-mobile .satellite-card .satellite-legend-body {
        height: clamp(72px, 22vw, 90px);
        gap: 6px;
    }

    .sg-mobile .satellite-card .satellite-legend-image {
        flex-basis: 9px;
        width: 9px;
    }

    .sg-mobile .satellite-card .satellite-legend-labels {
        font-size: 9px;
        line-height: 1.15;
    }

    .sg-mobile .satellite-card .satellite-map-legend.is-discrete {
        width: clamp(122px, 36vw, 150px);
    }

    .sg-mobile .satellite-card .satellite-map-legend.is-discrete .satellite-legend-labels {
        gap: 5px;
    }

    .sg-mobile .satellite-page .nav-tabs .nav-link {
        padding: 0.35rem 0.7rem;
    }
}

/* Agro Activities: allow the whole page to scroll on phones and keep wide
   tables scrollable within their own containers. */
@media (max-width: 600px) {
    .sg-mobile .agro-activities-page {
        height: auto !important;
        min-height: 0 !important;
        padding: 0.35rem 0.25rem 0 !important;
        overflow: visible;
    }

    .sg-mobile .agro-activities-page #agro-activities-tabs .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .sg-mobile .agro-activities-page #agro-activities-tabs .nav-link {
        flex: 0 0 auto;
        padding: 0.45rem 0.65rem;
        white-space: nowrap;
    }

    .sg-mobile .agro-activities-page .tab-content,
    .sg-mobile .agro-activities-page .tab-pane,
    .sg-mobile .agro-activities-page .tab-pane.active {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible;
    }

    .sg-mobile .agro-activities-page .tab-pane > .card,
    .sg-mobile .agro-activities-page .tab-pane > .card > .card-body {
        height: auto !important;
        min-height: 0 !important;
    }

    .sg-mobile .agro-activities-main-view,
    .sg-mobile .agro-activities-page .agro-activities-body {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
        width: 100%;
        max-width: 100%;
    }

    .sg-mobile .agro-activities-page .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .sg-mobile .agro-activities-page .dash-table-container,
    .sg-mobile .agro-activities-page .dash-spreadsheet-container {
        width: 100%;
        max-width: 100%;
        max-height: 65dvh !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y;
    }

    .sg-mobile .agro-activities-page #activity-diary-table .dash-spreadsheet-container {
        height: 65dvh !important;
        min-height: 320px !important;
    }

    .sg-mobile .agro-activities-page #activity-diary-table .dash-spreadsheet-inner {
        min-width: max-content;
    }

    .sg-mobile .agro-activities-page #agro-activities-tab-export-btn,
    .sg-mobile .agro-activities-page #agro-activities-tab-best-time-activities-export-btn {
        display: none !important;
    }

    .sg-mobile .agro-activities-page .modal-dialog {
        max-width: calc(100vw - 1rem);
        margin: 0.5rem auto;
    }

    .sg-mobile .agro-activities-page .modal-body {
        max-height: 68dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* The activities settings modal is rendered outside the page container,
       so size it directly by its stable modal ID (the layout has a 25vw width). */
    #generic-modal-agro-activities-tab-activities-setting .modal-dialog {
        width: min(94vw, 620px) !important;
        max-width: min(94vw, 620px) !important;
        margin: 0.5rem auto !important;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-content {
        display: flex;
        width: 100%;
        max-height: calc(100dvh - 1rem);
        overflow: hidden;
        border-radius: 1rem;
    }

    #generic-modal-agro-activities-tab-activities-setting .sg-modal-header {
        flex: 0 0 auto;
        align-items: center;
        gap: 0.5rem;
        padding: 0.7rem 0.85rem;
    }

    #generic-modal-agro-activities-tab-activities-setting .sg-icon {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        object-fit: contain;
    }

    #generic-modal-agro-activities-tab-activities-setting .sg-modal-title {
        min-width: 0;
        font-size: 1rem;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body {
        min-width: 0;
        padding: 0.75rem;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body > *,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .container-fluid,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .row,
    #generic-modal-agro-activities-tab-activities-setting .modal-body [class*="col-"] {
        min-width: 0;
        max-width: 100%;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .input-group {
        width: 100%;
        min-width: 0;
        flex-wrap: nowrap;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .input-group-text {
        flex: 0 0 auto;
        max-width: 38%;
        padding: 0.45rem 0.6rem;
        white-space: nowrap;
        font-size: 0.9rem;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select-control,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select-input,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select-value,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select-placeholder {
        min-width: 0;
        max-width: 100%;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select-control {
        width: 100%;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .rc-slider {
        width: 100%;
    }

    #generic-modal-agro-activities-tab-activities-setting .sg-modal-footer {
        flex: 0 0 auto;
        gap: 0.5rem;
        padding: 0.65rem 0.75rem;
    }

    #generic-modal-agro-activities-tab-activities-setting .sg-modal-footer .btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
        margin: 0;
        padding: 0.5rem;
        font-size: 0.95rem;
    }
}

/* The same modal is also used in phone landscape, where viewport width is
   larger than the portrait breakpoint but the inline 25vw width is still wrong. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 950px) and (pointer: coarse) and (hover: none) {
    #generic-modal-agro-activities-tab-activities-setting .modal-dialog {
        width: min(94vw, 760px) !important;
        max-width: min(94vw, 760px) !important;
        margin: 0.4rem auto !important;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-content {
        max-height: calc(100dvh - 0.8rem);
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body {
        min-width: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .container-fluid,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .row,
    #generic-modal-agro-activities-tab-activities-setting .modal-body [class*="col-"] {
        min-width: 0;
        max-width: 100%;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .input-group {
        width: 100%;
        min-width: 0;
    }

    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .Select-control,
    #generic-modal-agro-activities-tab-activities-setting .modal-body .rc-slider {
        min-width: 0;
        max-width: 100%;
    }
}

/* Sensors: fit filter controls and keep wide data tables horizontally scrollable. */
@media (max-width: 600px) {
    .sg-mobile #sensors-page {
        width: 100%;
        max-width: 100%;
        height: auto !important;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .sg-mobile #sensors-page > .container-fluid {
        display: flex;
        flex-direction: column;
        height: auto !important;
        min-height: 0;
    }

    .sg-mobile #sensors-page > .container-fluid > .row {
        flex: 0 0 auto !important;
        min-width: 0;
    }

    /* The desktop page uses a fixed-height flex chain. On a phone that chain
       has no reliable height, so the table cards must keep their own space. */
    .sg-mobile #sensors-page .sensors-setting-section-div {
        height: auto !important;
        min-height: 0;
        flex: 0 0 auto !important;
    }

    .sg-mobile #sensors-page .sensors-setting-section-div > .card {
        height: auto !important;
        min-height: 0;
        flex: 0 0 auto !important;
    }

    .sg-mobile #sensors-page .sg-page-content-top-navbar,
    .sg-mobile #sensors-page .sg-page-content-top-navbar .container-fluid,
    .sg-mobile #sensors-page .sg-page-content-top-navbar .container-fluid > div {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .sg-mobile #sensors-page .sg-page-content-top-navbar .container-fluid > div {
        flex-wrap: wrap;
        justify-content: flex-start !important;
        gap: 0.5rem;
        padding: 8px 10px;
    }

    .sg-mobile #sensors-page .sg-page-content-top-navbar h2 {
        font-size: 1.1rem !important;
        line-height: 1.25;
    }

    .sg-mobile #sensors-page .input-group {
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
        margin-left: 0 !important;
    }

    .sg-mobile #sensors-page .input-group-text {
        flex: 0 0 118px;
        justify-content: flex-start;
        padding-inline: 10px;
        white-space: nowrap;
    }

    .sg-mobile #sensors-page .input-group .form-select {
        width: 1% !important;
        min-width: 0;
        flex: 1 1 0;
        text-overflow: ellipsis;
    }

    .sg-mobile #sensors-page .sensors-controller-row {
        height: auto !important;
        min-height: 0;
        flex: 0 0 auto !important;
        margin-bottom: 8px;
    }

    .sg-mobile #sensors-page .sensors-controller-row > [class*="col-"],
    .sg-mobile #sensors-page .sensors-table-row > [class*="col-"] {
        min-width: 0;
    }

    .sg-mobile #sensors-page .sensors-controller-row .card,
    .sg-mobile #sensors-page .sensors-table-row .card {
        height: auto !important;
        min-height: 0;
    }

    .sg-mobile #sensors-page .sensors-controller-row .card-body,
    .sg-mobile #sensors-page .sensors-table-row .card-body {
        height: auto !important;
        flex: 0 0 auto !important;
        min-height: 0;
        overflow: visible;
    }

    .sg-mobile #sensors-page .sensors-controller-row .sensors-setting-controllers-data-table-div-body {
        height: 220px !important;
        min-height: 180px;
        flex: 0 0 220px !important;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sg-mobile #sensors-page .sensors-controller-row .card-header .container-fluid > div {
        flex-wrap: wrap;
        justify-content: flex-start !important;
        gap: 0.35rem;
        padding: 6px 10px;
    }

    .sg-mobile #sensors-page .sensors-controller-row .card-header .input-group {
        width: 100% !important;
    }

    .sg-mobile #sensors-page .sensors-table-row {
        height: auto !important;
        min-height: 0;
        flex: 0 0 auto !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-body > div {
        height: auto !important;
        min-height: 0;
        flex: 0 0 auto !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .sensors-setting-section-div,
    .sg-mobile #sensors-page .sensors-table-row .sensors-setting-section-div > .card,
    .sg-mobile #sensors-page .sensors-table-row .card-body,
    .sg-mobile #sensors-page .sensors-table-row .card-body > div {
        display: block !important;
        height: auto !important;
        min-height: 0;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"] > div {
        justify-content: flex-start !important;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin: 0 !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:nth-child(2) > div {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        justify-content: stretch !important;
        align-items: center;
        column-gap: 10px !important;
        row-gap: 8px !important;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-select {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        min-width: 0;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-select label {
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
        margin: 0 !important;
        padding: 6px 8px;
        border: 1px solid #d7e3dc;
        border-radius: 8px;
        background: #fff;
        font-size: 0.78rem !important;
        line-height: 1.25;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-count {
        margin: 0 !important;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-select-all {
        margin: 0 !important;
        min-width: 0;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:last-child > div {
        display: flex;
        justify-content: flex-start !important;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .sg-mobile #sensors-page #sensors-setting-table-hover-output {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
        margin: 0 !important;
    }

    .sg-mobile #sensors-page #sensors-export-visible-btn {
        display: none !important;
    }

    /* Keep every sensor header control in one horizontally scrollable row
       on narrow phones; the table title remains in the same toolbar. */
    .sg-mobile #sensors-page .sensors-table-row .card-header .row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"] {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:nth-child(2) {
        flex: 1 0 auto !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:nth-child(2) > div {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center;
        gap: 8px !important;
        width: max-content;
        margin: 0 !important;
        white-space: nowrap;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-select {
        flex-wrap: nowrap !important;
        width: max-content;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-select label {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-count,
    .sg-mobile #sensors-page #sensors-setting-sensors-select-all {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:last-child > div {
        flex-wrap: nowrap !important;
        width: max-content;
    }

    .sg-mobile #sensors-page #sensors-dis-associate-sensor-to-asset-button,
    .sg-mobile #sensors-page #sensors-associate-sensor-to-asset-button {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        border-radius: 8px !important;
    }

    .sg-mobile #sensors-page .sensors-search-bar {
        padding: 8px 10px;
        gap: 8px;
    }

    .sg-mobile #sensors-page #sensors-quick-search {
        width: 100%;
        flex: 1 1 100%;
        font-size: 0.9rem;
    }

    .sg-mobile #sensors-page #sensors-selection-summary,
    .sg-mobile #sensors-page #sensors-active-context {
        white-space: normal;
        overflow-wrap: anywhere;
        min-width: 0;
    }

    .sg-mobile #sensors-page #sensors-table-viewport {
        display: block !important;
        position: relative;
        width: 100%;
        max-width: 100%;
        height: max(42dvh, 300px) !important;
        min-height: 240px;
        flex: 0 0 auto !important;
        overflow: hidden;
    }

    .sg-mobile #sensors-page #sensors-sensors-data-table,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-table-container,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-spreadsheet-container,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-spreadsheet.dash-freeze-top {
        display: block !important;
        visibility: visible !important;
        height: 100% !important;
        min-height: 240px;
        max-height: 100% !important;
    }

    .sg-mobile #sensors-page #sensors-controllers-data-table .dash-table-container,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-table-container,
    .sg-mobile #sensors-page #sensors-controllers-data-table .dash-spreadsheet-container,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-spreadsheet-container {
        max-width: 100%;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
}

/* Sensors landscape: compact the filter toolbar and reserve room for both tables. */
@media (orientation: landscape) and (max-height: 600px) and (max-width: 1200px) {
    /* Keep the sensors page in the shell's vertical scroll flow on short
       landscape viewports (iOS otherwise clips the second table). */
    .sg-mobile .sg-main-content:has(#sensors-page) {
        height: 0 !important;
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    .sg-mobile #page-content:has(#sensors-page) {
        display: block !important;
        height: auto !important;
        flex: 0 0 auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page.sensors-setting-page-container {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        touch-action: pan-y;
    }

    .sg-mobile #sensors-page {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page > .container-fluid,
    .sg-mobile #sensors-page > .container-fluid > .row {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page > .container-fluid > .row > [class*="col-"] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0;
    }

    .sg-mobile #sensors-page .sensors-setting-section-div,
    .sg-mobile #sensors-page .sensors-setting-section-div > .card {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page .sensors-setting-section-div > .card > .card-body {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page .sensors-controller-row {
        height: auto !important;
        min-height: 0;
        margin-bottom: 6px;
    }

    .sg-mobile #sensors-page .sensors-controller-row .sensors-setting-controllers-data-table-div-body {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page #sensors-controllers-data-table,
    .sg-mobile #sensors-page #sensors-controllers-data-table .dash-table-container,
    .sg-mobile #sensors-page #sensors-controllers-data-table .dash-spreadsheet-container {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    .sg-mobile #sensors-page .sensors-table-row {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        flex: 0 0 auto !important;
        margin-top: 6px;
        margin-bottom: 12px;
    }

    .sg-mobile #sensors-page .sensors-table-row > [class*="col-"] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .sensors-setting-section-div,
    .sg-mobile #sensors-page .sensors-table-row .sensors-setting-section-div > .card,
    .sg-mobile #sensors-page .sensors-table-row .card-body {
        min-height: 0 !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-body > div {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"] {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:nth-child(2) {
        flex: 1 0 auto !important;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:first-child > div {
        justify-content: flex-start !important;
        white-space: nowrap;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:nth-child(2) > div {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        align-items: center;
        gap: 8px !important;
        width: max-content;
        margin: 0 !important;
        white-space: nowrap;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-select {
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 4px;
        width: max-content;
        min-width: 0;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-select label {
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
        min-width: 0;
        margin: 0 !important;
        padding: 4px 6px;
        border: 1px solid #d7e3dc;
        border-radius: 8px;
        background: #fff;
        font-size: 0.72rem !important;
        line-height: 1.25;
        white-space: nowrap;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-filter-count {
        flex: 0 0 auto;
        margin: 0 !important;
        font-size: 0.78rem !important;
    }

    .sg-mobile #sensors-page #sensors-setting-sensors-select-all {
        flex: 0 0 auto;
        margin: 0 !important;
        min-width: 0;
        white-space: nowrap;
        font-size: 0.72rem;
    }

    .sg-mobile #sensors-page .sensors-table-row .card-header .row > [class*="col-"]:last-child > div {
        display: flex !important;
        justify-content: flex-start !important;
        align-items: center;
        flex-wrap: nowrap !important;
        gap: 6px;
        width: max-content;
    }

    .sg-mobile #sensors-page #sensors-export-visible-btn {
        display: none !important;
    }

    .sg-mobile #sensors-page #sensors-dis-associate-sensor-to-asset-button,
    .sg-mobile #sensors-page #sensors-associate-sensor-to-asset-button {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 !important;
        border-radius: 8px !important;
    }

    .sg-mobile #sensors-page .sensors-search-bar {
        padding: 8px 10px;
        gap: 8px;
    }

    .sg-mobile #sensors-page #sensors-quick-search {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
        font-size: 0.9rem;
    }

    .sg-mobile #sensors-page #sensors-selection-summary,
    .sg-mobile #sensors-page #sensors-active-context {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
        min-width: 0;
    }

    .sg-mobile #sensors-page #sensors-table-viewport {
        display: block !important;
        position: relative;
        width: 100%;
        flex: 0 0 auto !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        /* Allow the page to keep scrolling vertically when a swipe begins
           over the horizontally scrollable table. */
        touch-action: pan-x pan-y;
    }

    .sg-mobile #sensors-page #sensors-sensors-data-table,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-table-container,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-spreadsheet-container,
    .sg-mobile #sensors-page #sensors-sensors-data-table .dash-spreadsheet.dash-freeze-top {
        display: block !important;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    /* Keep landscape tables inside bounded, independently scrollable areas.
       Expanding every row into the page flow can stall mobile browsers. */
    .sg-mobile #sensors-page .sensors-controllers-disclosure[open] {
        height: auto !important;
        max-height: none !important;
    }

    .sg-mobile #sensors-page .sensors-controllers-disclosure[open] .sensors-setting-controllers-data-table-div-body {
        display: block !important;
        height: clamp(150px, 34vh, 260px) !important;
        max-height: 34vh !important;
        min-height: 120px !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] {
        height: auto !important;
        max-height: none !important;
    }

    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] .sensors-setting-section-div,
    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] .sensors-setting-section-div > .card,
    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] .card-body {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] #sensors-table-viewport {
        display: block !important;
        height: clamp(180px, 48vh, 340px) !important;
        max-height: 48vh !important;
        min-height: 160px !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }

    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] #sensors-sensors-data-table,
    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] #sensors-sensors-data-table .dash-table-container,
    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] #sensors-sensors-data-table .dash-spreadsheet-container,
    .sg-mobile #sensors-page .sensors-sensors-disclosure[open] #sensors-sensors-data-table .dash-spreadsheet.dash-freeze-top {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        overflow: auto !important;
    }
}

/* Measurement picker: scope to this dialog, including Bootstrap portal rendering. */
@media (max-width: 767px), (max-height: 600px) and (pointer: coarse) {
    .modal:has(#vcm-tabs) .modal-dialog {
        width: calc(100% - 20px) !important;
        max-width: 960px !important;
        margin: 10px auto !important;
    }
    .modal:has(#vcm-tabs) .modal-content {
        max-height: calc(100dvh - 20px);
        border-radius: 14px;
        overflow: hidden;
    }
    .modal:has(#vcm-tabs) .modal-header {
        padding: 12px 16px;
        flex-shrink: 0;
    }
    .modal:has(#vcm-tabs) .modal-title { font-size: 18px; line-height: 1.3; }
    .modal:has(#vcm-tabs) .modal-body {
        padding: 12px;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
    }
    .modal:has(#vcm-tabs) .modal-footer { padding: 8px 12px; flex-shrink: 0; }
    #vcm-tabs { display: flex; flex-wrap: nowrap; margin-bottom: 12px; }
    #vcm-tabs .nav-item { flex: 1 1 0; min-width: 0; }
    #vcm-tabs .nav-link { width: 100%; padding: 10px 8px; font-size: 13px; line-height: 1.3; white-space: normal; }
    .modal:has(#vcm-tabs) .tab-content { width: 100%; min-width: 0; }
    #vcm-unit-search { width: 100%; min-width: 0 !important; flex-basis: 100% !important; min-height: 44px; }
    #vcm-only-available-measurements { white-space: normal !important; }
    #vcm-pu-selection-accordion { max-height: none !important; overflow: visible !important; }
    #vcm-pu-selection-accordion .accordion-button { padding: 12px; font-size: 15px; }
    #vcm-pu-selection-accordion .accordion-body { padding: 8px; }
    #vcm-pu-selection-accordion .card-body { padding: 0 !important; }
    #vcm-pu-selection-accordion .card-body > div > .row { display: none; }
    #vcm-pu-selection-accordion .vcm-unit-search-row {
        padding: 10px;
        margin-bottom: 8px;
        border: 1px solid #d7e1da;
        border-radius: 10px;
        background: #f7faf8;
    }
    #vcm-pu-selection-accordion .vcm-unit-search-row .row { margin: 0; row-gap: 8px; }
    #vcm-pu-selection-accordion .row > .col-6 { flex: 0 0 85%; width: 85%; overflow-wrap: anywhere; }
    #vcm-pu-selection-accordion .row > .col-1 { flex: 0 0 15%; width: 15%; }
    #vcm-pu-selection-accordion .row > .col-5 { flex: 0 0 100%; width: 100%; min-width: 0; }
    #vcm-pu-selection-accordion .Select { width: 100%; min-width: 0; font-size: 13px; }
    #vcm-pu-selection-accordion .Select-value { max-width: 100%; }
    #vcm-pu-selection-accordion .Select-value-label { white-space: normal !important; overflow-wrap: anywhere; }
    #vcm-columns-config-accordion { max-width: 100%; overflow-x: auto; }
}

/* Independent native disclosure groups for mobile irrigation recommendations. */
.sg-mobile .ir-header-row > .ir-mobile-section {
    width: 100%;
    padding: 0;
    border: 1px solid #d5e1d9;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.sg-mobile .ir-mobile-section > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    background: #eaf3ed;
    color: #315540;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.sg-mobile .ir-mobile-section > summary::-webkit-details-marker { display: none; }
.sg-mobile .ir-mobile-section > summary::after { content: "＋"; margin-inline-start: auto; }
.sg-mobile .ir-mobile-section[open] > summary::after { content: "−"; }
.sg-mobile .ir-mobile-section-body { padding: 8px; min-width: 0; }
.sg-mobile .ir-mobile-section-body .ir-header-col { width: 100%; flex: 0 0 100%; }

/* Plan tools must size their fields independently of desktop Bootstrap columns. */
.sg-mobile .ir-mobile-section .ir-plan-tools {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 8px;
    align-items: end !important;
    margin: 0;
}
.sg-mobile .ir-mobile-section .ir-plan-tools > [class*="col"] {
    width: 100%;
    min-width: 0;
    padding: 0;
}
.sg-mobile .ir-mobile-section .ir-plan-tools > :has(#irrigation-recommendation-export-btn) { display: none; }
.sg-mobile .ir-mobile-section .ir-plan-tools > :has(#irrigation-recommendation-display-mode-select) { grid-column: 2; grid-row: 1; }
.sg-mobile .ir-mobile-section .ir-plan-tools > :has(#irrigation-recommendation-display-resolution-select) { grid-column: 3; grid-row: 1; }
.sg-mobile .ir-mobile-section .ir-plan-tools > :has(#irrigation-recommendation-follower-checkbox) { grid-column: 1 / 3; grid-row: 2; }
.sg-mobile .ir-mobile-section .ir-plan-tools > :has(#irrigation-recommendation-show-salt-wash-checkbox) { grid-column: 3; grid-row: 2; }
.sg-mobile .ir-mobile-section .ir-select-label {
    display: block;
    min-height: 34px;
    margin: 0 0 5px;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
}
.sg-mobile .ir-mobile-section .ir-compact-select {
    width: 100% !important;
    min-width: 0;
    height: 44px;
    font-size: 13px;
    padding-left: 8px;
}
.sg-mobile .ir-mobile-section .ir-follower-checkbox { white-space: normal; font-size: 13px; line-height: 1.35; }
.sg-mobile .ir-mobile-section .ir-square-action-btn { width: 44px !important; height: 44px !important; min-height: 44px !important; }
.sg-mobile .ir-mobile-section .ir-control-group { min-width: 0; padding: 10px; }

/* All four recommendation editors are portalled outside the page shell. */
@media (max-width: 767px), (max-height: 600px) and (pointer: coarse) {
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) {
        max-height: 100dvh !important;
        padding: 0 !important;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) {
        width: calc(100vw - 16px) !important;
        max-width: 960px !important;
        margin: 8px auto !important;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-content {
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
        overflow: hidden;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-header {
        padding: 10px 12px;
        gap: 8px;
        flex-shrink: 0;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .sg-modal-title {
        font-size: 18px;
        line-height: 1.3;
        overflow-wrap: normal;
        word-break: normal;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-header .sg-icon {
        width: 30px;
        height: 30px;
        object-fit: contain;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body {
        padding: 12px;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-footer {
        flex-shrink: 0;
        padding: 8px 12px;
        gap: 8px;
        background: #f5f8f6;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-footer .btn {
        min-height: 44px;
        flex: 1 1 0;
        margin: 0;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body .container-fluid { padding: 0; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body .row {
        flex-wrap: wrap !important;
        row-gap: 10px;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body .row > [class*="col"] {
        min-width: 0 !important;
        max-width: 100%;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body .row > [class*="col"]:not(.col-auto):not(.col-12) {
        flex: 1 1 100%;
        width: 100% !important;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body :is(input:not([type="checkbox"]):not([type="radio"]), select) {
        min-height: 44px;
        max-width: 100%;
        min-width: 0 !important;
        font-size: 16px;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body :is(label,.form-check-label) {
        white-space: normal !important;
        line-height: 1.35;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .modal-body .btn { min-height: 44px; white-space: normal; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .nav-tabs { display: flex; flex-wrap: wrap; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .nav-tabs .nav-item { flex: 1 1 auto; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .nav-link { padding: 10px; font-size: 13px; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .dash-table-container { max-width: 100%; min-width: 0; overflow-x: auto; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .Select { min-width: 0; width: 100%; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .Select-control { min-height: 44px; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .Select-value-label { white-space: normal !important; overflow-wrap: anywhere; }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .DateInput,
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .SingleDatePickerInput { max-width: 100%; }
}

@media (max-width: 767px), (max-height: 600px) and (pointer: coarse) {
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .input-group {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 4px 0;
        margin-bottom: 10px;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .input-group-text {
        width: 100%;
        white-space: normal;
        padding: 6px 8px;
        font-size: 13px;
        line-height: 1.3;
        border-radius: 6px !important;
    }
    .modal-dialog:has([id^="generic-modal-body-irrigation-recommendation-"]) .input-group > :is(input,select,.Select) {
        width: 100% !important;
        flex: 1 1 100%;
        margin-left: 0 !important;
        border-radius: 6px !important;
    }
}

@media (max-width: 767px), (max-height: 600px) and (pointer: coarse) {
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        padding: 0 !important;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields > .input-group {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 36px;
        gap: 5px 0;
        align-content: start;
        margin: 0 !important;
        min-width: 0;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group-text {
        grid-column: 1 / -1;
        padding: 0;
        min-height: 34px;
        background: transparent;
        border: 0;
        font-size: 12px;
        font-weight: 600;
        align-items: start;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group > :is(input,.w-100) {
        grid-column: 1 / -1;
        width: 100% !important;
        height: 44px;
        min-width: 0;
        margin: 0 !important;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group:has(input[type="time"]) > input {
        grid-column: 1;
        border-radius: 6px 0 0 6px !important;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group > .btn {
        grid-column: 2;
        grid-row: 2;
        width: 36px;
        height: 44px;
        padding: 0;
        margin: 0;
        border: 1px solid #d5ded8;
        border-radius: 0 6px 6px 0;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .modal-body { scroll-padding-top: 12px; }
}

/* Pulse parameters: one complete label/control pair per row. */
@media (max-width: 767px), (max-height: 600px) and (pointer: coarse) {
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields > .input-group {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
        align-items: center;
        gap: 0;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group-text {
        grid-column: 1;
        grid-row: 1;
        min-height: 0;
        padding-right: 10px;
        align-items: center;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group > :is(input,.w-100) {
        grid-column: 2 / -1;
        grid-row: 1;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group:has(input[type="time"]) > input {
        grid-column: 2;
        grid-row: 1;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group > .btn {
        grid-column: 3;
        grid-row: 1;
    }
}

/* Uniform interaction height within every pulse parameter row. */
@media (max-width: 767px), (max-height: 600px) and (pointer: coarse) {
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group {
        min-height: 44px;
        align-items: center;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group > :is(input,select,.w-100,.btn),
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .Select-control {
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px;
        box-sizing: border-box;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .Select-placeholder,
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .Select-value {
        line-height: 42px !important;
    }
    .modal-dialog:has(.ir-pulse-parameter-fields) .ir-pulse-parameter-fields .input-group-text {
        min-height: 44px;
        display: flex;
        align-items: center;
        box-sizing: border-box;
    }
}

.sg-mobile .lw-input-disclosure {
    width: 100%;
    border: 1px solid #d5e1d9;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.sg-mobile .lw-input-disclosure > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    background: #eaf3ed;
    color: #315540;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.sg-mobile .lw-input-disclosure > summary::-webkit-details-marker { display: none; }
.sg-mobile .lw-input-disclosure > summary::after { content: "＋"; margin-inline-start: auto; }
.sg-mobile .lw-input-disclosure[open] > summary::after { content: "−"; }
.sg-mobile .lw-input-disclosure #limited-water-toolbar-resize-handle { display: none; }
.sg-mobile .lw-input-disclosure #limited-water-toolbar-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.sg-mobile .irrigation-tracker-input-disclosure {
    width: 100%;
    border: 1px solid #d5e1d9;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.sg-mobile .irrigation-tracker-input-disclosure > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    background: #eaf3ed;
    color: #315540;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.sg-mobile .irrigation-tracker-input-disclosure > summary::-webkit-details-marker { display: none; }
.sg-mobile .irrigation-tracker-input-disclosure > summary::after { content: "＋"; margin-inline-start: auto; }
.sg-mobile .irrigation-tracker-input-disclosure[open] > summary::after { content: "−"; }
.sg-mobile .irrigation-tracker-input-disclosure #irrigation-tracker-toolbar-resize-handle { display: none; }
.sg-mobile .irrigation-tracker-input-disclosure #irrigation-tracker-toolbar-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.sg-mobile .agro-insights-input-disclosure {
    width: 100%;
    border: 1px solid #d5e1d9;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.sg-mobile .agro-insights-input-disclosure > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    background: #eaf3ed;
    color: #315540;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.sg-mobile .agro-insights-input-disclosure > summary::-webkit-details-marker { display: none; }
.sg-mobile .agro-insights-input-disclosure > summary::after { content: "＋"; margin-inline-start: auto; }
.sg-mobile .agro-insights-input-disclosure[open] > summary::after { content: "−"; }
.sg-mobile .agro-insights-input-disclosure .agro-insights-navbar {
    position: static !important;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
}
.sg-mobile .agro-insights-input-disclosure .agro-insights-toolbar-resize-handle { display: none !important; }
.sg-mobile .agro-insights-input-disclosure .agro-insights-toolbar-content {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Irrigation Tracker controls: a consistent portrait stack and compact landscape grid. */
@media (max-width: 767px) {
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-resizable-toolbar,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-content,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar {
        display: block;
        padding: 6px 8px 4px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 7px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls > .agro-toolbar-divider {
        display: none !important;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls > .agro-toolbar-section {
        display: grid;
        grid-template-columns: 76px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        width: 100%;
        min-width: 0;
        min-height: 54px;
        margin: 0;
        padding: 5px 9px;
        box-sizing: border-box;
        border: 1px solid #d7e1da;
        border-radius: 10px;
        background: #fff;
    }
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-section-label {
        justify-self: start;
        margin: 0;
        color: #243c31;
        font-size: 0.72rem;
        font-weight: 700;
        line-height: 1.2;
        text-align: left;
        white-space: nowrap;
    }
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-section .agro-toolbar-pill,
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-section > .form-select,
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-section .form-select {
        width: 100% !important;
        min-width: 0 !important;
        height: 42px !important;
        min-height: 42px !important;
        margin: 0;
        box-sizing: border-box;
    }
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-pill {
        display: flex;
        align-items: center;
        padding: 4px 8px;
        box-sizing: border-box;
        border: 1px solid #d7e1da;
        border-radius: 8px;
        background: #fff;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row {
        display: grid;
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
        align-items: stretch;
        gap: 7px;
        width: 100%;
        min-width: 0;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row > .agro-toolbar-section {
        display: grid;
        grid-template-columns: 67px minmax(0, 1fr);
        align-items: center;
        gap: 5px;
        min-width: 0;
        min-height: 56px;
        padding: 6px 7px;
        border: 1px solid #d7e1da;
        border-radius: 10px;
        background: #fff;
        box-sizing: border-box;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row .agro-toolbar-section-label {
        font-size: 0.68rem;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-type-section {
        grid-template-columns: 36px minmax(0, 1fr) !important;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-type-section .form-select {
        padding: 0.375rem 1.5rem 0.375rem 0.5rem;
        font-size: 0.76rem;
        text-overflow: ellipsis;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-plant-units-section .sg-btns {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        justify-self: end;
        padding: 0 !important;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-view-section .agro-toolbar-pill,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-options-section .agro-toolbar-pill {
        justify-content: flex-start;
        gap: 12px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .agro-toolbar-pill > .mb-0 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: center;
        gap: 2px 8px;
        width: 100%;
    }
    /* Give Show its full row: three long labels cannot share the narrow control
       column used by the other labeled settings. */
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section {
        grid-template-columns: minmax(0, 1fr) !important;
        align-content: start;
        gap: 4px;
        padding: 6px 9px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .agro-toolbar-section-label {
        align-self: start;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .agro-toolbar-pill {
        width: 100%;
        height: auto !important;
        min-height: 68px !important;
        padding: 2px 6px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .form-check-inline {
        width: 100%;
        min-width: 0;
        margin: 0 !important;
        overflow: hidden;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .form-check-label {
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-pill .form-check-inline {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
        min-height: 32px;
        margin: 0 !important;
        padding: 0;
        white-space: nowrap;
    }
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-pill .form-check-input {
        position: static;
        float: none;
        flex: 0 0 16px;
        width: 16px;
        height: 16px;
        margin: 0 !important;
    }
    .sg-mobile .irrigation-tracker-mobile .agro-toolbar-pill .form-check-label {
        min-width: 0;
        margin: 0;
        font-size: 0.78rem;
        line-height: 1.15;
        white-space: nowrap;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-view-section .form-check-inline,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-options-section .form-check-inline {
        min-height: 32px;
        margin-right: 0 !important;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-options-section .agro-toolbar-pill > .mb-0 {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 4px 12px;
        width: 100%;
    }
    .sg-mobile .irrigation-tracker-mobile #irrigation-tracker-display-selection {
        width: 100% !important;
    }
}

@media (orientation: landscape) and (max-height: 600px) and (max-width: 950px) {
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-resizable-toolbar,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-navbar,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-navbar .container-fluid,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-content,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls {
        width: 100%;
        max-width: none;
        min-width: 0;
        box-sizing: border-box;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar {
        display: block;
        padding: 4px 8px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-navbar {
        padding: 4px 8px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        gap: 6px 8px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls > .agro-toolbar-section {
        display: grid;
        grid-template-columns: 62px minmax(0, 1fr);
        min-height: 50px;
        padding: 3px 7px;
        gap: 6px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-view-section {
        grid-column: 1;
        grid-row: 1;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-toolbar-controls > .irrigation-tracker-chart-view-section {
        grid-template-columns: 130px minmax(0, 1fr) !important;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-chart-view-section {
        grid-column: 2;
        grid-row: 1;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row {
        grid-column: 1 / -1;
        grid-row: 2;
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
        gap: 8px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-unit-type-row > .agro-toolbar-section {
        min-height: 50px;
        padding: 3px 8px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section {
        grid-column: 1;
        grid-row: 3;
        grid-template-columns: 54px minmax(0, 1fr) !important;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-options-section {
        grid-column: 2;
        grid-row: 3;
        grid-template-columns: 58px minmax(0, 1fr) !important;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .agro-toolbar-pill {
        height: auto !important;
        min-height: 72px !important;
        padding: 3px 7px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .agro-toolbar-pill > .mb-0 {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: center;
        width: 100%;
        gap: 0 6px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-show-section .form-check-label,
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-options-section .form-check-label {
        font-size: 0.74rem;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-options-section .agro-toolbar-pill {
        min-height: 72px !important;
        padding: 4px 7px;
    }
    .sg-mobile .irrigation-tracker-mobile .irrigation-tracker-options-section .agro-toolbar-pill > .mb-0 {
        align-content: center;
        gap: 2px 8px;
    }
}
