@charset "UTF-8";

@font-face { font-family: 'IRANYekanXFaNum'; src: url('fonts/IRANYekanXFaNum-Regular.ttf') format('truetype'); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: 'IRANYekanXFaNum'; src: url('fonts/IRANYekanXFaNum-Bold.ttf') format('truetype'); font-style: normal; font-weight: 700; font-display: swap; }

:root {
  --green-950: #043d35;
  --green-800: #066A61;
  --green-700: #087F74;
  --green-100: #dff2ed;
  --green-50: #f0faf7;
  --ink: #172421;
  --muted: #64716e;
  --line: #dce5e2;
  --surface: #ffffff;
  --canvas: #f4f7f6;
  --red: #b42318;
  --red-soft: #fee9e7;
  --amber: #9a5b08;
  --amber-soft: #fff3d6;
  --shadow: 0 14px 40px rgba(18, 54, 47, .12);
  --radius: 18px;
  color-scheme: light;
  font-family: 'IRANYekanXFaNum', Tahoma, "Segoe UI", Arial, sans-serif;
}
body, button, input, select, textarea, .leaflet-container, .leaflet-popup-content { font-family: 'IRANYekanXFaNum', Tahoma, "Segoe UI", Arial, sans-serif; }

/* Farm infrastructure map */
.facility-page-heading { align-items: flex-end; }
.facility-workspace { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; min-height: 690px; direction: ltr; }
.facility-map-panel,
.facility-sidebar,
.facility-editor { border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 12px 35px rgba(13, 55, 47, .08); }
.facility-map-panel { position: relative; min-width: 0; overflow: hidden; direction: rtl; }
.facility-map { width: 100%; height: 690px; background: #dce6e1; }
.facility-map.is-drawing { cursor: crosshair; }
.facility-map-actions { position: absolute; z-index: 700; top: 14px; right: 14px; display: flex; gap: 7px; }
.facility-map-actions button { display: inline-flex; min-height: 40px; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid rgba(7,95,82,.18); border-radius: 11px; background: rgba(255,255,255,.96); color: var(--green-800); font: inherit; font-size: .72rem; font-weight: 900; box-shadow: 0 6px 18px rgba(18,50,44,.12); cursor: pointer; }
.facility-map-actions button:disabled { opacity: .55; cursor: wait; }
.facility-drawing-bar { position: absolute; z-index: 750; right: 50%; bottom: 22px; display: flex; width: min(720px, calc(100% - 32px)); align-items: center; gap: 7px; padding: 10px; border: 1px solid #c9dbd6; border-radius: 15px; background: rgba(255,255,255,.97); box-shadow: 0 14px 38px rgba(10,45,39,.2); transform: translateX(50%); }
.facility-drawing-bar strong { margin-left: auto; color: #304b45; font-size: .78rem; }
.facility-drawing-bar button { min-height: 36px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #42534f; font: inherit; font-size: .69rem; font-weight: 800; cursor: pointer; }
.facility-drawing-bar button.is-primary { border-color: var(--green-700); background: var(--green-700); color: #fff; }
.facility-map-key { position: absolute; z-index: 650; right: 14px; bottom: 14px; display: flex; gap: 12px; padding: 8px 11px; border-radius: 10px; background: rgba(255,255,255,.9); color: #53635f; font-size: .65rem; font-weight: 800; box-shadow: 0 5px 18px rgba(20,45,40,.1); }
.facility-map-key span { display: inline-flex; align-items: center; gap: 5px; }
.facility-map-key i { display: inline-block; width: 11px; height: 11px; border: 2px solid #087F74; }
.facility-map-key .key-point { border-radius: 50%; background: #087F74; }
.facility-map-key .key-line { height: 3px; border: 0; background: #087F74; transform: rotate(-25deg); }
.facility-map-key .key-area { background: rgba(8,127,109,.22); }
.facility-sidebar { display: flex; min-width: 0; max-height: 690px; flex-direction: column; overflow: hidden; direction: rtl; }
.facility-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 17px 13px; border-bottom: 1px solid var(--line); }
.facility-sidebar-head div { display: grid; gap: 2px; }
.facility-sidebar-head strong { color: var(--ink); font-size: .92rem; }
.facility-sidebar-head span { color: var(--muted); font-size: .68rem; }
.facility-layer-filter { padding: 12px 14px; border-bottom: 1px solid var(--line); background: #f9fbfa; }
.facility-layer-filter label { cursor: pointer; }
.facility-filter-all { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; color: var(--green-800); font-size: .75rem; font-weight: 900; }
.facility-layer-filter > div { display: grid; max-height: 150px; grid-template-columns: 1fr; gap: 4px; overflow-y: auto; }
.facility-layer-filter > div label { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; align-items: center; gap: 7px; padding: 5px 3px; color: #465650; font-size: .69rem; }
.facility-layer-filter i,
.facility-list-item i { width: 10px; height: 10px; border-radius: 50%; background: var(--feature-color); box-shadow: 0 0 0 3px rgba(8, 117, 101, .13); }
.facility-layer-filter b { min-width: 20px; padding: 2px 5px; border-radius: 999px; background: #edf2f0; color: #64716d; text-align: center; font-size: .6rem; }
.facility-list { display: grid; align-content: start; gap: 7px; padding: 11px; overflow-y: auto; }
.facility-list-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 5px; padding: 7px; border: 1px solid transparent; border-radius: 12px; background: #f8faf9; transition: .15s ease; }
.facility-list-item.is-selected { border-color: #9acfc3; background: var(--green-50); }
.facility-list-item > button { display: grid; min-width: 0; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 9px; padding: 4px; border: 0; background: transparent; text-align: right; cursor: pointer; }
.facility-list-item > button span { display: grid; min-width: 0; gap: 2px; }
.facility-list-item > button strong { overflow: hidden; color: #263d37; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.facility-list-item > button small { overflow: hidden; color: var(--muted); font-size: .61rem; text-overflow: ellipsis; white-space: nowrap; }
.facility-list-item > div { display: flex; align-items: center; gap: 3px; }
.facility-list-item > div form { margin: 0; }
.facility-list-item > div button { padding: 3px 5px; border: 0; background: transparent; color: var(--green-800); font: inherit; font-size: .61rem; font-weight: 800; cursor: pointer; }
.facility-list-item > div form button { color: var(--red); }
.facility-editor { position: absolute; z-index: 900; top: 14px; right: 14px; width: min(500px, calc(100% - 28px)); max-height: calc(100% - 28px); overflow-y: auto; direction: rtl; box-shadow: 0 20px 55px rgba(8,42,36,.24); }
.facility-editor[hidden] { display: none; }
.facility-editor > header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.facility-editor > header div { display: grid; gap: 2px; }
.facility-editor > header span { color: var(--green-700); font-size: .67rem; font-weight: 900; }
.facility-editor > header h2 { margin: 0; font-size: 1.05rem; }
.facility-editor > header button,
.facility-sidebar-head > button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #40514c; font-size: 1.25rem; cursor: pointer; }
.facility-editor form { padding: 15px 17px 17px; }
.facility-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.facility-form-grid > label { display: grid; gap: 6px; color: #3d514b; font-size: .72rem; font-weight: 800; }
.facility-form-grid input,
.facility-form-grid select,
.facility-form-grid textarea { width: 100%; min-height: 43px; border: 1px solid #d6dfdc; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; }
.facility-form-grid textarea { min-height: 82px; resize: vertical; }
.facility-form-grid .span-2 { grid-column: 1 / -1; }
.facility-draw-picker { margin: 0; padding: 10px; border: 1px solid #d6dfdc; border-radius: 12px; }
.facility-draw-picker legend { padding: 0 6px; color: #3d514b; font-size: .72rem; font-weight: 900; }
.facility-draw-picker > div { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.facility-draw-picker button { display: flex; min-height: 50px; align-items: center; justify-content: center; gap: 5px; padding: 6px; border: 1px solid #dce4e1; border-radius: 10px; background: #f8faf9; color: #465852; font: inherit; font-size: .68rem; font-weight: 800; cursor: pointer; }
.facility-draw-picker button.is-recommended { border-color: #8fc7ba; background: var(--green-50); color: var(--green-800); }
.facility-draw-picker p { margin: 8px 2px 0; color: var(--muted); font-size: .66rem; }
.facility-draw-picker p.has-geometry { color: var(--green-800); font-weight: 900; }
.facility-draw-picker p.is-error { color: var(--red); }
.facility-editor-actions { display: flex; gap: 8px; margin-top: 14px; }
.facility-popup { min-width: 190px; direction: rtl; text-align: right; }
.facility-popup > span { display: inline-flex; align-items: center; gap: 5px; color: var(--feature-color); font-size: .64rem; font-weight: 900; }
.facility-popup > span::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--feature-color); }
.facility-popup h3 { margin: 5px 0 3px; color: #1f3932; font-size: .95rem; }
.facility-popup p { margin: 3px 0; color: #596762; font-size: .7rem; }
.facility-popup dl { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.facility-popup dl div { padding: 4px 7px; border-radius: 7px; background: #f0f5f3; color: #3c514b; font-size: .64rem; font-weight: 800; }
.facility-popup .facility-popup-notes { padding-top: 6px; border-top: 1px solid #e5ebe9; line-height: 1.7; }
.facility-mobile-add { position: fixed; z-index: 820; right: 18px; bottom: calc(82px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border: 0; border-radius: 17px; background: var(--green-700); color: #fff; font-size: 1.8rem; box-shadow: 0 12px 28px rgba(7,95,82,.3); }

@media (max-width: 900px) {
  .facility-workspace { grid-template-columns: minmax(0,1fr); min-height: 0; }
  .facility-map { height: min(70vh, 680px); min-height: 520px; }
  .facility-sidebar { max-height: none; }
}

@media (max-width: 680px) {
  .page-farm-map .admin-shell { padding: 10px 10px calc(92px + env(safe-area-inset-bottom)); }
  .facility-page-heading { align-items: center; }
  .facility-page-heading > .button { display: none; }
  .facility-workspace { display: block; }
  .facility-map-panel { border-radius: 16px; }
  .facility-map { height: calc(100dvh - 225px); min-height: 450px; }
  .facility-sidebar { position: fixed; z-index: 850; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 10px; display: none; max-height: min(68vh, 590px); border-radius: 22px; box-shadow: 0 20px 60px rgba(8,42,36,.28); }
  .facility-sidebar.is-open { display: flex; }
  .facility-map-actions { top: 10px; right: 10px; }
  .facility-map-actions button { width: 42px; height: 42px; justify-content: center; padding: 0; font-size: 1rem; }
  .facility-map-actions button span { display: none; }
  .facility-map-key { display: none; }
  .facility-drawing-bar { bottom: 12px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; padding: 10px; }
  .facility-drawing-bar strong { grid-column: 1 / -1; margin: 0 0 3px; text-align: center; }
  .facility-drawing-bar button { min-height: 40px; padding: 5px; font-size: .62rem; }
  .facility-editor { position: fixed; z-index: 950; top: auto; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: calc(100% - 16px); max-height: 88dvh; border-radius: 24px; }
  .facility-editor > header { padding: 15px 16px; }
  .facility-editor form { padding: 14px 15px 18px; }
  .facility-form-grid { gap: 10px; }
  .facility-draw-picker > div { gap: 5px; }
  .facility-draw-picker button { min-height: 54px; flex-direction: column; }
  .facility-editor-actions { position: sticky; bottom: -18px; padding: 11px 0 0; background: #fff; }
  .facility-editor-actions .button { flex: 1; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html[dir="rtl"], html[dir="rtl"] body { direction: rtl; }
html, body { margin: 0; min-height: 100%; color: var(--ink); }
body { font-size: 16px; line-height: 1.65; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(8, 117, 101, .25);
  outline-offset: 2px;
}

/* Public map */
.map-body { overflow: hidden; background: #dce8e5; }
.map-app { display: grid; grid-template-columns: 370px minmax(0, 1fr); height: 100vh; height: 100dvh; direction: rtl; }
.map-sidebar {
  position: relative;
  z-index: 700;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 255, 255, .98);
  border-left: 1px solid rgba(4, 61, 53, .12);
  box-shadow: -8px 0 34px rgba(20, 58, 50, .1);
  direction: rtl;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 22px 14px; }
.sidebar-head h1 { margin: 2px 0 0; font-size: 1.55rem; line-height: 1.3; }
.eyebrow { color: var(--green-700); font-size: .78rem; font-weight: 800; letter-spacing: .02em; }
.map-mode-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 0 20px 13px; padding: 4px; border-radius: 12px; background: #edf3f1; }
.map-mode-switch button { min-height: 38px; padding: 5px 9px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: .78rem; font-weight: 900; }
.map-mode-switch button.is-active { background: white; color: var(--green-800); box-shadow: 0 3px 10px rgba(4, 61, 53, .1); }
.map-mode-panel { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.map-mode-panel[hidden] { display: none !important; }
.map-filters { padding: 0 20px 14px; border-bottom: 1px solid var(--line); }
.search-box { display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--canvas); }
.search-box span { color: var(--green-700); font-size: 1.3rem; }
.search-box input { width: 100%; min-height: 46px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.select-label { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: .88rem; font-weight: 700; }
.select-label select { min-height: 43px; border: 1px solid var(--line); border-radius: 11px; padding: 0 10px; background: white; color: var(--ink); }
.selection-actions { display: flex; gap: 8px; margin-top: 10px; }
.selection-actions button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: var(--green-50); color: var(--green-800); cursor: pointer; font-size: .8rem; font-weight: 800; }
.selection-actions button:last-child { background: #f1f3f2; color: var(--muted); }
.list-summary { display: flex; justify-content: space-between; padding: 12px 20px 8px; color: var(--muted); font-size: .78rem; }
.list-summary strong { color: var(--green-800); }
.farm-list { flex: 1; overflow-y: auto; padding: 2px 12px 14px; overscroll-behavior: contain; }
.farm-row { display: grid; width: 100%; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; min-height: 64px; margin: 5px 0; padding: 9px 10px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--ink); text-align: right; cursor: pointer; transition: .16s ease; }
.farm-row:hover { border-color: var(--line); background: var(--green-50); }
.farm-row input { width: 18px; height: 18px; accent-color: var(--green-700); }
.farm-row-pin { width: 12px; height: 12px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; background: var(--green-700); box-shadow: 0 0 0 2px var(--green-700); transform: rotate(-45deg); }
.farm-row-text { min-width: 0; display: flex; flex-direction: column; }
.farm-row-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
.farm-row-text small { color: var(--muted); font-size: .75rem; }
.farm-row button { width: 38px; height: 38px; border: 0; border-radius: 11px; background: white; color: var(--green-700); box-shadow: 0 3px 12px rgba(10, 76, 65, .1); cursor: pointer; font-size: 1.5rem; line-height: 1; }
.sidebar-footer { display: flex; align-items: center; gap: 9px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sidebar-footer a { color: var(--green-700); font-size: .83rem; font-weight: 800; text-decoration: none; }
.dashboard-entry { flex: 1; text-align: center; }
.install-app-button { min-height: 44px; flex: 1; margin: 0; border: 1px solid var(--green-100); border-radius: 11px; background: var(--green-50); color: var(--green-800); cursor: pointer; font-weight: 800; }
.install-app-button.icon-only { display: grid; width: 44px; flex: 0 0 44px; place-items: center; padding: 0; }
.install-app-button.icon-only[hidden] { display: none; }
.install-app-button.icon-only span { display: none; }
.install-app-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.install-app-button:not(.icon-only) svg { display: none; }
.login-icon-link { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 4px 14px rgba(4, 61, 53, .08); }
.login-icon-link:hover { border-color: #a9cec5; background: var(--green-50); }
.login-icon-link svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.login-icon-link span { display: none; }
.map-stage { position: relative; min-width: 0; direction: rtl; }
#map { width: 100%; height: 100%; background: #d9ebe7; }
.open-list-button { display: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 690; background: rgba(2, 30, 26, .48); backdrop-filter: blur(2px); }
.icon-button { display: inline-grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); cursor: pointer; font-size: 1.45rem; }
.mobile-only { display: none; }
.mobile-app-nav { display: none; }
.map-message { position: absolute; z-index: 650; right: 50%; bottom: 26px; transform: translateX(50%); max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: .85rem; }
.pin-wrap { background: transparent; border: 0; }
.map-pin { position: relative; width: 30px; height: 30px; border: 4px solid white; border-radius: 50% 50% 50% 0; background: var(--green-700); box-shadow: 0 4px 14px rgba(4, 61, 53, .36); transform: rotate(-45deg); }
.map-pin::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: white; }
.map-pin.active { background: #df7b16; }
.farm-cluster-wrap { background: transparent; border: 0; }
.farm-cluster { display: grid; width: 42px; height: 42px; place-items: center; border: 3px solid #fff; border-radius: 50%; background: #087F74; color: #fff; font-family: 'IRANYekanXFaNum', Tahoma, sans-serif; font-size: .82rem; font-weight: 800; box-shadow: 0 5px 15px rgba(4,61,53,.34); }
.farm-popup { min-width: 220px; padding: 3px; direction: rtl; font-family: 'IRANYekanXFaNum', Tahoma, sans-serif; }
.farm-popup h3 { margin: 5px 0 13px; font-size: 1rem; }
.popup-region { color: var(--green-700); font-size: .73rem; font-weight: 800; }
.popup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.popup-actions button { min-height: 40px; border: 0; border-radius: 10px; background: var(--green-700); color: white; cursor: pointer; font-size: .78rem; font-weight: 800; }
.popup-actions button.secondary { background: var(--green-50); color: var(--green-800); }
.farm-popup-profile-link { display: inline-flex; align-items: center; gap: 5px; color: #183b33; text-decoration: none; transition: color .15s ease; }
.farm-popup-profile-link:hover { color: var(--green-700); }
.farm-popup-profile-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(180deg); transition: transform .15s ease; }
.farm-popup-profile-link:hover svg { transform: rotate(180deg) translateX(-2px); }
.nearest-disease { margin: 11px 0 0; padding: 9px 10px; border: 1px solid #f2c7c2; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: .73rem; line-height: 1.6; }
.nearest-disease strong, .nearest-disease b { font-weight: 900; }
.nearest-disease.none { border-color: var(--line); background: var(--canvas); color: var(--muted); }
.leaflet-popup-content-wrapper { border-radius: 15px; box-shadow: 0 14px 40px rgba(8, 48, 41, .2); }
.leaflet-popup-content { margin: 13px; }
.popup-notes { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.popup-notes-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.popup-notes-head strong { color: var(--green-950); font-size: .88rem; }
.popup-notes-head span { color: var(--muted); font-size: .7rem; }
.popup-notes-loading, .popup-notes-empty, .popup-notes-error { margin: 7px 0; padding: 9px; border-radius: 10px; background: var(--canvas); color: var(--muted); font-size: .74rem; text-align: center; }
.popup-notes-error { background: var(--red-soft); color: var(--red); }
.popup-notes-list { display: grid; gap: 6px; }
.popup-note-item { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfc; }
.popup-note-toggle { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 9px 10px; border: 0; background: white; color: var(--ink); cursor: pointer; text-align: right; }
.popup-note-toggle::after { content: "+"; grid-column: 2; grid-row: 1 / span 2; color: var(--green-700); font-size: 1.1rem; font-weight: 900; }
.popup-note-toggle[aria-expanded="true"] { background: var(--green-50); }
.popup-note-toggle[aria-expanded="true"]::after { content: "−"; }
.popup-note-toggle span { grid-column: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; font-weight: 800; }
.popup-note-toggle time { grid-column: 1; color: var(--muted); font-size: .64rem; }
.popup-note-content { padding: 10px; border-top: 1px solid var(--line); }
.popup-note-content p { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .76rem; }
.popup-note-content footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .67rem; }
.popup-note-delete, .note-delete-button { padding: 3px 7px; border: 0; border-radius: 7px; background: var(--red-soft); color: var(--red); cursor: pointer; font-size: .66rem; font-weight: 900; }
.tracking-panel { padding: 0 12px 12px; }
.farm-tracking-picker { display: flex; flex-direction: column; gap: 4px; padding: 12px 8px 4px; color: var(--green-900); font-size: .76rem; font-weight: 900; }
.farm-tracking-picker select { width: 100%; min-height: 43px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font: inherit; font-weight: 600; }
.farm-tracking-picker .search-select { margin-top: 0; }
.farm-tracking-picker .search-select-trigger { min-height: 43px; }
.tracking-controls { display: flex; justify-content: flex-end; align-items: center; padding: 2px 8px 8px; border-bottom: 1px solid var(--line); }
.tracking-today { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.tracking-today strong { color: var(--green-900); font-size: .82rem; }
.tracking-today span { color: var(--muted); font-size: .65rem; line-height: 1.65; }
.tracking-refresh { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--green-800); cursor: pointer; font-size: 1.25rem; font-weight: 900; }
.tracking-summary { display: flex; flex-wrap: wrap; gap: 5px; padding: 11px 8px 7px; }
.tracking-summary span { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 999px; background: var(--canvas); color: var(--muted); font-size: .66rem; font-weight: 800; }
.tracking-summary b { color: var(--green-800); }
.tracking-summary .is-arrived { background: var(--green-100); color: var(--green-800); }
.tracking-summary .is-attention { background: var(--amber-soft); color: var(--amber); }
.tracking-legend { display: flex; flex-wrap: wrap; gap: 10px; padding: 2px 9px 9px; color: var(--muted); font-size: .64rem; }
.tracking-legend span { display: inline-flex; align-items: center; gap: 4px; }
.tracking-legend i { width: 8px; height: 8px; border-radius: 50%; background: #2374ab; }
.tracking-legend i.arrived { background: var(--green-700); }
.tracking-legend i.to-slaughterhouse { background: #8c4fc3; }
.tracking-legend i.at-slaughterhouse { background: #317b5c; }
.tracking-legend i.stale { background: #8b9693; }
.tracking-list { display: grid; flex: 1; align-content: start; gap: 6px; overflow-y: auto; padding: 0 2px 9px; overscroll-behavior: contain; }
.tracking-row { display: grid; width: 100%; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 72px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); cursor: pointer; text-align: right; }
.tracking-row:hover { border-color: #a9cec5; background: #fbfdfc; }
.tracking-status-dot { width: 11px; height: 11px; border-radius: 50%; background: #2374ab; box-shadow: 0 0 0 5px rgba(35, 116, 171, .1); }
.tracking-row.is-arrived .tracking-status-dot { background: var(--green-700); box-shadow: 0 0 0 5px rgba(8, 117, 101, .1); }
.tracking-row.is-to_slaughterhouse .tracking-status-dot { background: #8c4fc3; box-shadow: 0 0 0 5px rgba(140, 79, 195, .12); }
.tracking-row.is-at_slaughterhouse .tracking-status-dot { background: #317b5c; box-shadow: 0 0 0 5px rgba(49, 123, 92, .12); }
.tracking-row.is-stale .tracking-status-dot, .tracking-row.is-unavailable .tracking-status-dot, .tracking-row.is-disabled .tracking-status-dot { background: #8b9693; box-shadow: 0 0 0 5px rgba(100, 113, 110, .1); }
.tracking-row.is-no_tracker .tracking-status-dot, .tracking-row.is-expired .tracking-status-dot { background: var(--amber); box-shadow: 0 0 0 5px rgba(154, 91, 8, .1); }
.tracking-row-main, .tracking-row-state { display: flex; min-width: 0; flex-direction: column; }
.tracking-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.tracking-row-main small { overflow: hidden; color: var(--muted); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.tracking-row-main small.tracking-eta { color: #175f85; font-weight: 800; }
.tracking-row-main small.tracking-eta.is-late { color: #ab4038; }
.tracking-row-state { align-items: flex-end; }
.tracking-row-state b { color: #2374ab; font-size: .7rem; }
.tracking-row.is-arrived .tracking-row-state b { color: var(--green-700); }
.tracking-row.is-to_slaughterhouse .tracking-row-state b { color: #7e3fb9; }
.tracking-row.is-at_slaughterhouse .tracking-row-state b { color: #317b5c; }
.tracking-row.is-stale .tracking-row-state b, .tracking-row.is-unavailable .tracking-row-state b, .tracking-row.is-disabled .tracking-row-state b { color: var(--muted); }
.tracking-row.is-no_tracker .tracking-row-state b, .tracking-row.is-expired .tracking-row-state b { color: var(--amber); }
.tracking-row-state small { max-width: 125px; color: var(--muted); font-size: .59rem; text-align: left; }
.tracking-footnote { margin: 0; padding: 8px 7px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .62rem; }
.vehicle-pin-wrap { background: transparent; border: 0; }
.vehicle-pin { display: grid; width: 42px; height: 42px; place-items: center; border: 4px solid white; border-radius: 15px; background: #2374ab; color: white; box-shadow: 0 6px 18px rgba(19, 69, 104, .32); }
.vehicle-pin svg { width: 25px; height: 25px; fill: currentColor; }
.vehicle-pin.is-arrived { background: var(--green-700); }
.vehicle-pin.is-to_slaughterhouse { background: #8c4fc3; }
.vehicle-pin.is-at_slaughterhouse { background: #317b5c; }
.vehicle-pin.is-stale, .vehicle-pin.is-unavailable, .vehicle-pin.is-disabled { background: #7b8784; }
.vehicle-pin.is-no_tracker, .vehicle-pin.is-expired { background: var(--amber); }
.vehicle-popup { min-width: 215px; direction: rtl; }
.vehicle-popup-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.vehicle-popup h3 { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-popup-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.vehicle-popup-action { display: inline-flex; min-height: 30px; align-items: center; justify-content: center; gap: 4px; padding: 5px 7px; border: 1px solid #b7d6cf; border-radius: 8px; background: var(--green-50); color: var(--green-800); cursor: pointer; font: inherit; text-decoration: none; white-space: nowrap; }
.vehicle-popup-action span { font-size: .95rem; font-weight: 900; line-height: 1; }
.vehicle-popup-action b { font-size: .59rem; }
.vehicle-popup-action.is-call { border-color: var(--green-700); background: var(--green-700); color: white; }
.vehicle-popup-action:disabled { cursor: wait; opacity: .55; }
.vehicle-popup-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; color: var(--muted); font-size: .66rem; }
.vehicle-popup ul { display: grid; gap: 5px; margin: 10px 0 0; padding: 0; list-style: none; }
.vehicle-popup li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 7px 8px; border-radius: 8px; background: var(--canvas); }
.vehicle-popup li strong { font-size: .72rem; }
.vehicle-popup li span { color: var(--muted); font-size: .64rem; }
.vehicle-route-action { padding: 5px 9px; border: 1px solid #a9cde2; border-radius: 8px; background: #ebf6fc; color: #175f85; cursor: pointer; font: inherit; font-size: .63rem; font-weight: 900; }
.route-dialog { width: min(460px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 20px; background: transparent; }
.route-dialog::backdrop { background: rgba(2, 30, 26, .55); backdrop-filter: blur(4px); }
.dialog-card { padding: 20px; border-radius: 20px; background: white; box-shadow: var(--shadow); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 2px 0 16px; font-size: 1.25rem; }
.route-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.route-option { display: flex; align-items: center; gap: 10px; min-height: 74px; padding: 11px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; transition: .15s ease; }
.route-option:hover { border-color: #a9cec5; background: var(--green-50); }
.route-icon { display: grid; width: 40px; height: 40px; flex: 0 0 40px; place-items: center; border-radius: 12px; background: var(--green-100); color: var(--green-800); font-weight: 900; }
.route-option span:last-child { display: flex; min-width: 0; flex-direction: column; }
.route-option strong { font-size: .85rem; }
.route-option small { color: var(--muted); font-size: .7rem; }

/* Dashboard */
.admin-body { min-height: 100vh; background: var(--canvas); }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 68px; padding: 10px clamp(16px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; color: var(--green-950); font-weight: 900; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: var(--green-800); color: white; font-size: 1.35rem; }
.topnav { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: 8px 11px; border-radius: 9px; color: #43504d; font-size: .83rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.topnav a:hover { background: var(--green-50); color: var(--green-800); }
.mobile-top-actions { display: none; }
.notification-nav-link { display: inline-flex; align-items: center; gap: 6px; }
.notification-count { display: inline-grid; min-width: 21px; height: 21px; padding: 0 5px; place-items: center; border-radius: 999px; background: var(--red); color: white; font-size: .66rem; }
.nav-install { flex: 0 0 auto; padding: 8px 11px; border: 0; border-radius: 9px; background: var(--green-50); color: var(--green-800); cursor: pointer; font-size: .83rem; font-weight: 800; white-space: nowrap; }
.admin-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 56px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.15rem); line-height: 1.35; }
.page-heading p { margin: 5px 0 0; color: var(--muted); }
.heading-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.back-link { display: inline-block; margin-bottom: 4px; color: var(--green-700); font-size: .82rem; font-weight: 800; text-decoration: none; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; padding: 8px 17px; border: 1px solid var(--green-700); border-radius: 11px; background: var(--green-700); color: white; cursor: pointer; font-weight: 800; text-decoration: none; }
.button:hover { background: var(--green-800); }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button-secondary { border-color: var(--green-100); background: var(--green-50); color: var(--green-800); }
.button-secondary:hover { background: var(--green-100); }
.button-ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.button-danger { border-color: var(--red); background: var(--red); }
.button-danger:hover { background: #8f1c13; }
.button-small { min-height: 36px; padding: 5px 11px; font-size: .78rem; }
.text-link, .table-link, .text-button { border: 0; background: transparent; color: var(--green-700); cursor: pointer; font-weight: 800; text-decoration: none; }
.text-danger { color: var(--red); }
.row-actions { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.panel { margin-bottom: 18px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 24px rgba(31, 64, 57, .05); }
.panel h2 { margin: 0 0 16px; font-size: 1.1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.panel-head > span, .panel-head > div > span { color: var(--muted); font-size: .78rem; }
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.stat-card { min-height: 115px; padding: 18px; border: 1px solid #d9e9e5; border-radius: 17px; background: linear-gradient(145deg, #fff, var(--green-50)); }
.stat-card span { display: block; color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat-card strong { display: block; margin-top: 10px; color: var(--green-800); font-size: 2rem; line-height: 1; }
.stat-card.danger { border-color: #f3d4d0; background: linear-gradient(145deg, #fff, #fff4f2); }
.stat-card.danger strong { color: var(--red); }
.dashboard-heading { align-items: center; }
.dashboard-heading .eyebrow { color: var(--green-700); }
.dashboard-heading-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; }
.dashboard-stats .stat-card { min-height: 132px; }
.dashboard-stats .stat-card small { display: block; margin-top: 10px; color: var(--muted); font-size: .75rem; }
.dashboard-stats .stat-card small a { color: var(--green-700); text-decoration: none; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 16px; }
.dashboard-panel .panel-head { margin-bottom: 16px; }
.dashboard-panel .panel-head h2 { margin: 0; }
.dashboard-panel .panel-head a { color: var(--green-700); font-size: .82rem; font-weight: 800; text-decoration: none; }
.dashboard-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dashboard-status-grid > div { min-height: 90px; display: flex; flex-direction: column; justify-content: space-between; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--green-50); }
.dashboard-status-grid strong { color: var(--green-800); font-size: 1.65rem; line-height: 1; }
.dashboard-status-grid span { color: var(--muted); font-size: .72rem; }
.dashboard-attention > a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: .82rem; }
.dashboard-attention > a:last-child { border-bottom: 0; }
.dashboard-attention > a strong { color: var(--amber); font-size: 1rem; }
.dashboard-programmes { display: grid; gap: 7px; }
.dashboard-programmes > a { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 13px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-size: .78rem; }
.dashboard-programmes > a:hover { background: var(--green-50); }
.dashboard-programmes > a > span:first-child { display: flex; min-width: 0; flex-direction: column; }
.dashboard-programmes strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-programmes small { color: var(--muted); }
.dashboard-timeline { margin: 0; padding: 0; list-style: none; }
.dashboard-event { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.dashboard-event:last-child { border-bottom: 0; }
.dashboard-event-dot { width: 10px; height: 10px; margin-top: 7px; border-radius: 50%; background: var(--green-700); }
.dashboard-event.is-sms .dashboard-event-dot { background: #4476bb; }
.dashboard-event.is-farm_arrival .dashboard-event-dot, .dashboard-event.is-slaughter_arrival .dashboard-event-dot { background: #22957c; }
.dashboard-event.is-farm_departure .dashboard-event-dot { background: #8c4fc3; }
.dashboard-event > div { display: flex; min-width: 0; flex-direction: column; }
.dashboard-event strong { font-size: .81rem; }
.dashboard-event a { overflow: hidden; color: var(--green-700); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.dashboard-event small, .dashboard-event time, .dashboard-scope { color: var(--muted); font-size: .7rem; }
.dashboard-event time { direction: ltr; white-space: nowrap; }
.dashboard-pages { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.dashboard-scope { margin: 14px 0 0; }
.vehicle-assignment-modes { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.vehicle-assignment-modes label { display: inline-flex; align-items: center; gap: 6px; }
#existingVehicleFields { margin: 10px 0; }
#reassignWarning { display: flex; align-items: flex-start; gap: 9px; margin-top: 10px; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .dashboard-heading { align-items: flex-start; }
  .dashboard-heading-actions { width: 100%; justify-content: space-between; }
  .dashboard-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-programmes > a { grid-template-columns: minmax(0, 1fr) auto; }
  .dashboard-programmes > a .badge { grid-column: 2; }
  .dashboard-event { grid-template-columns: 10px minmax(0, 1fr); }
  .dashboard-event time { grid-column: 2; }
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 11px; border-bottom: 1px solid #edf1f0; text-align: right; vertical-align: middle; }
th { color: var(--muted); font-size: .76rem; font-weight: 800; }
td { font-size: .87rem; }
tbody tr:last-child td { border-bottom: 0; }
.actions-cell { white-space: nowrap; }
.icon-actions { display: flex; align-items: center; gap: 7px; }
.icon-action { display: inline-grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--green-700); text-decoration: none; transition: .15s ease; }
.icon-action:hover { border-color: #a9cec5; background: var(--green-50); }
.icon-action svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-actions form { margin: 0; }
.icon-action-danger { color: var(--red); cursor: pointer; }
.icon-action-danger:hover { border-color: #edc5c0; background: #fff2f0; }
.table-subtext { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; font-weight: 400; }
.empty-cell, .empty-state { padding: 28px; color: var(--muted); text-align: center; }
.badge { display: inline-flex; min-height: 26px; align-items: center; margin: 2px; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; white-space: nowrap; }
.badge-green { background: var(--green-100); color: var(--green-800); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-muted { background: #eff2f1; color: #697470; }
.alert { margin: 0 0 16px; padding: 12px 15px; border-radius: 12px; font-size: .86rem; font-weight: 700; }
.alert-success { background: var(--green-100); color: var(--green-950); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-warning { background: var(--amber-soft); color: var(--amber); }
.muted { color: var(--muted); }
.form-panel.narrow, .auth-card { max-width: 560px; }
.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
label { color: #36433f; font-size: .82rem; font-weight: 800; }
input, select, textarea { width: 100%; min-height: 45px; margin-top: 6px; padding: 9px 11px; border: 1px solid #cfdad7; border-radius: 10px; background: white; color: var(--ink); }
textarea { resize: vertical; }
input[readonly] { background: #f2f5f4; color: var(--muted); }
.form-actions { display: flex; gap: 9px; margin-top: 4px; }
.permission-box { display: grid; gap: 8px; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
.permission-box legend { padding: 0 7px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.check-row { display: flex; align-items: center; gap: 8px; min-height: 34px; cursor: pointer; }
.check-row input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--green-700); }
.inline-form, .table-form { display: flex; align-items: flex-end; gap: 9px; }
.inline-form .grow { flex: 1; }
.table-form input { min-width: 180px; margin: 0; }
.filter-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; align-items: end; gap: 12px; }
.new-user-panel { padding: 0; overflow: hidden; }
.new-user-panel > summary { display: flex; align-items: center; gap: 12px; padding: 17px 20px; cursor: pointer; list-style: none; }
.new-user-panel > summary::-webkit-details-marker { display: none; }
.new-user-panel > summary::after { content: "⌄"; margin-right: auto; color: var(--green-700); font-size: 1.35rem; font-weight: 900; transition: transform .18s ease; }
.new-user-panel[open] > summary::after { transform: rotate(180deg); }
.summary-icon { display: grid; width: 39px; height: 39px; flex: 0 0 39px; place-items: center; border-radius: 12px; background: var(--green-100); color: var(--green-800); font-size: 1.3rem; }
.new-user-panel summary > span:nth-child(2) { display: flex; flex-direction: column; }
.new-user-panel summary small { color: var(--muted); font-size: .72rem; font-weight: 400; }
.new-user-form { padding: 20px; border-top: 1px solid var(--line); background: #fbfdfc; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 14px; }
.users-panel { padding: 0; overflow: hidden; }
.users-panel > .panel-head { margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.users-list { display: grid; }
.user-row { display: grid; grid-template-columns: auto minmax(150px, .8fr) minmax(260px, 1.5fr) auto auto; align-items: center; gap: 15px; min-height: 82px; padding: 14px 20px; border-bottom: 1px solid #edf1f0; }
.user-row:last-child { border-bottom: 0; }
.user-row:hover { background: #fbfdfc; }
.user-avatar { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; background: var(--green-100); color: var(--green-800); }
.user-avatar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.user-identity { display: flex; min-width: 0; flex-direction: column; }
.user-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.user-identity span { color: var(--muted); font-size: .73rem; text-align: right; }
.user-permission-summary { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px; }
.permission-chip { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: var(--canvas); color: #52605c; font-size: .68rem; font-weight: 800; }
.permission-chip.gps-chip-active { background: #e4f4ff; color: #17658f; }
.permission-chip.gps-chip-muted { background: #eff2f1; color: var(--muted); }
.user-row-actions { display: flex; gap: 7px; }
.user-row-actions .icon-action { cursor: pointer; }
.management-dialog { width: min(620px, calc(100% - 24px)); max-height: calc(100dvh - 28px); padding: 0; overflow: visible; border: 0; border-radius: 20px; background: transparent; }
.management-dialog::backdrop { background: rgba(2, 30, 26, .58); backdrop-filter: blur(4px); }
.user-dialog-card, .password-dialog-card { display: grid; max-height: calc(100dvh - 28px); gap: 16px; overflow-y: auto; }
.user-dialog-card .dialog-head h2, .password-dialog-card .dialog-head h2 { margin-bottom: 0; }
.password-dialog-card { width: min(460px, 100%); margin: 0 auto; }
.account-state { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); cursor: pointer; }
.account-state input { width: 19px; min-height: 19px; margin: 0; accent-color: var(--green-700); }
.account-state span { display: flex; flex-direction: column; }
.account-state small { color: var(--muted); font-size: .7rem; font-weight: 400; }
.driver-gps-box { gap: 11px; background: #fbfdfc; }
.field-help { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 400; }
.gps-form-grid { gap: 10px; }
.gps-current-state { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-radius: 9px; background: var(--canvas); color: var(--muted); font-size: .7rem; font-weight: 700; }
.gps-current-state small { color: var(--amber); }
.gps-remove-row { color: var(--red); font-size: .72rem; }
.reset-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.reset-form label { flex: 1; }
.auth-card { margin: 7vh auto 0; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: var(--shadow); text-align: center; }
.auth-card h1 { margin: 8px 0 4px; }
.auth-card .form-stack { margin-top: 22px; text-align: right; }
.auth-card .text-link { display: inline-block; margin-top: 18px; }
.auth-icon { display: grid; width: 58px; height: 58px; margin: 0 auto; place-items: center; border-radius: 18px; background: var(--green-800); color: white; font-size: 1.7rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); gap: 18px; }
.details-list { margin: 0 0 20px; }
.details-list > div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf1f0; }
.details-list dt { color: var(--muted); font-size: .78rem; font-weight: 700; }
.details-list dd { margin: 0; font-size: .86rem; font-weight: 800; }
.note-form { display: grid; gap: 9px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.note-form .button { justify-self: start; }
.note-list { display: grid; gap: 10px; margin-top: 16px; }
.note { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfc; }
.note p { margin: 0 0 9px; white-space: normal; }
.note footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .72rem; }
.note footer form { margin: 0; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-color: #f0c9c5; background: #fffafa; }
.danger-zone h2 { margin-bottom: 2px; color: var(--red); }
.danger-zone p { margin: 0; color: var(--muted); font-size: .82rem; }
.disease-distance-panel { grid-column: 1 / -1; }
.disease-distance-panel .panel-head { margin-bottom: 9px; }
.disease-count { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: var(--red-soft); color: var(--red) !important; font-weight: 900; }
.disease-distance-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.disease-distance-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 62px; padding: 9px 11px; border: 1px solid #f0d5d2; border-radius: 12px; background: #fffafa; color: inherit; text-decoration: none; }
.disease-distance-row:hover { border-color: #dfaaa5; background: #fff5f4; }
.disease-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px rgba(180, 35, 24, .09); }
.disease-farm-name { display: flex; min-width: 0; flex-direction: column; }
.disease-farm-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .83rem; }
.disease-farm-name small { color: var(--muted); font-size: .68rem; }
.disease-distance-value { color: var(--red); font-size: .76rem; font-weight: 900; white-space: nowrap; }

.import-panel { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr); gap: 26px; }
.import-help ol { margin: 0; padding-right: 21px; color: var(--muted); font-size: .88rem; }
.import-help li + li { margin-top: 7px; }
.upload-box { display: grid; align-content: center; gap: 13px; padding: 22px; border: 2px dashed #b8d4cd; border-radius: 16px; background: var(--green-50); }
.upload-box label { display: flex; flex-direction: column; gap: 2px; text-align: center; }
.upload-box label strong { color: var(--green-950); font-size: 1rem; }
.upload-box label span { color: var(--muted); font-size: .75rem; }
.upload-box input[type="file"] { height: auto; padding: 10px; background: white; }
.order-api-panel { display: flex; align-items: center; justify-content: space-between; gap: 22px; border-color: #b9ddd5; background: linear-gradient(135deg, #f7fffd, #eaf8f4); }
.order-api-copy { display: grid; min-width: 0; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 12px; }
.order-api-copy > div { min-width: 0; }
.order-api-copy h2 { margin: 0 0 3px; font-size: 1.05rem; }
.order-api-copy p { margin: 0; color: #52615e; font-size: .78rem; }
.order-api-copy small { grid-column: 2; color: var(--muted); font-size: .69rem; }
.order-api-copy .order-api-warning { color: var(--amber); font-weight: 800; }
.order-api-badge { display: inline-grid; min-width: 112px; min-height: 48px; grid-row: 1 / span 2; place-items: center; padding: 7px 10px; border-radius: 13px; background: var(--green-700); color: white; font-size: .72rem; font-weight: 900; white-space: nowrap; }
.order-api-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.order-api-actions form { margin: 0; }
.order-api-actions .button { white-space: nowrap; }

.load-plan-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.load-plan-overview > div { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.load-plan-overview span { color: var(--muted); font-size: .76rem; font-weight: 800; }
.load-plan-overview strong { color: var(--green-800); font-size: 1.3rem; line-height: 1; }
.load-plan-guidance { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 9px 12px; border: 1px solid #cfe5df; border-radius: 11px; background: var(--green-50); }
.load-plan-guidance p { margin: 0; color: #43534f; font-size: .78rem; }
.load-plan-guidance a { color: var(--green-800); font-weight: 900; }
.weather-alert { border-color: #efb7b0; background: #fff1ef; color: #9b2118; }
.guidance-icon { display: grid; width: 24px; height: 24px; flex: 0 0 24px; place-items: center; border-radius: 50%; background: var(--green-700); color: white; font-size: .76rem; font-weight: 900; }
.load-lines-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: 0 6px 22px rgba(31, 64, 57, .05); }
.load-lines-scroll { overflow-x: auto; }
.load-line-header, .load-line-row { display: grid; min-width: 1110px; grid-template-columns: 44px minmax(250px, 1.55fr) minmax(140px, .9fr) 150px 68px 80px 78px 122px 42px; align-items: center; gap: 7px; }
.load-line-header { min-height: 42px; padding: 0 10px; border-bottom: 1px solid var(--line); background: #eef7f4; color: var(--muted); font-size: .68rem; font-weight: 900; }
.load-line-list { display: grid; }
.load-line-row { min-height: 58px; padding: 7px 10px; border-bottom: 1px solid #edf1f0; }
.load-line-row:last-child { border-bottom: 0; }
.load-line-row:hover { background: #fbfdfc; }
.load-control { display: contents; }
.load-line-row > select, .load-line-row > input, .load-control select, .load-control input { min-width: 0; min-height: 38px; margin: 0; padding: 5px 7px; border-radius: 8px; font-size: .72rem; }
.load-time-control { display: block; min-width: 0; }
.load-time-control > input[data-schedule-trigger] { width: 100%; cursor: pointer; caret-color: transparent; text-align: center; }
.load-schedule-dialog { width: min(520px, calc(100% - 24px)); }
.load-schedule-card { display: grid; gap: 16px; direction: rtl; }
.load-schedule-card .dialog-head h2 { margin-bottom: 0; }
.load-schedule-fields { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 12px; }
.load-schedule-fields > label { display: grid; align-content: start; gap: 7px; color: #40504c; font-size: .78rem; font-weight: 800; }
.load-schedule-fields > label > input { min-height: 50px; margin: 0; border-radius: 12px; text-align: center; font-size: 1rem; }
.schedule-date-field { grid-template-columns: minmax(0, 1fr) auto; }
.load-schedule-card .schedule-date-field input, .load-schedule-card .schedule-date-field button { min-height: 50px; margin: 0; }
.schedule-date-field button { padding-inline: 13px; }
.schedule-calendar { padding: 2px 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdfc; }
.schedule-calendar[hidden] { display: none; }
.schedule-calendar .jalali-nav { margin-top: 10px; }
.schedule-today { width: 100%; margin-top: 12px; }
.load-line-index { color: var(--green-800); text-align: center; }
.load-line-farm { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.load-line-farm select { min-width: 0; min-height: 38px; margin: 0; padding: 5px 7px; border: 1px solid #cfdad7; border-radius: 8px; background: white; font-size: .72rem; }
.load-line-farm small { overflow: hidden; color: var(--muted); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.load-line-meta { display: flex; max-width: 158px; flex-direction: column; align-items: flex-end; gap: 3px; }
.weather-metrics { display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; white-space: nowrap; }
.weather-badge { display: inline-flex; width: fit-content; max-width: 112px; padding: 2px 6px; border-radius: 999px; font-size: .61rem !important; font-weight: 900; line-height: 1.25; }
.weather-badge.is-hot { background: #ffe5e1; color: #b42318; }
.weather-badge.is-safe { background: #e5f6f1; color: #087F74; }
.weather-badge.is-humidity { background: #e8f3fb; color: #17678f; }
.weather-badge.is-muted { background: #f0f3f2; color: #697773; }
.compact-return-toggle { display: block; min-width: 0; cursor: pointer; }
.compact-return-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.compact-return-toggle span { display: flex; min-height: 36px; align-items: center; justify-content: center; padding: 4px 7px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); font-size: .7rem; font-weight: 900; transition: .15s ease; }
.compact-return-toggle input:checked + span { border-color: var(--green-700); background: var(--green-700); color: white; box-shadow: 0 4px 12px rgba(8, 117, 101, .18); }
.load-note-button { position: relative; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--green-800); cursor: pointer; font-size: .7rem; font-weight: 900; }
.load-note-button.has-note { border-color: #9ecfc3; background: var(--green-50); }
.load-note-button.has-note::after { content: ""; position: absolute; top: 5px; left: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--green-700); }
.delivery-state { display: flex; min-width: 0; flex-direction: column; overflow: hidden; color: var(--muted); font-size: .66rem; }
.delivery-state strong, .delivery-state span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; }
.delivery-state small { color: var(--amber); font-size: .61rem; }
.delivery-state.is-seen small { color: var(--green-700); }
.row-delete-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #f1c9c5; border-radius: 9px; background: white; color: var(--red); cursor: pointer; font-size: 1.15rem; line-height: 1; }
.row-delete-button:hover { background: var(--red-soft); }
.load-lines-empty { min-width: 1110px; margin: 0; padding: 26px; color: var(--muted); text-align: center; }
.load-note-dialog-card, .manual-row-card { display: grid; gap: 15px; }
.manual-field-label { display: block; }
.manual-return > span { min-height: 45px; flex-direction: column; gap: 1px; }
.manual-return strong { font-size: .74rem; }
.manual-return small { color: inherit; font-size: .6rem; font-weight: 500; opacity: .78; }
.note-scope-options { display: grid; gap: 7px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.note-scope-options legend { padding: 0 6px; color: var(--muted); font-size: .75rem; font-weight: 800; }
.note-scope-options label { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 9px; cursor: pointer; }
.note-scope-options label:hover { background: var(--canvas); }
.note-scope-options input { width: 17px; min-height: 17px; margin: 0; accent-color: var(--green-700); }
.note-scope-options span { display: flex; flex-direction: column; }
.note-scope-options small { color: var(--muted); font-size: .66rem; font-weight: 400; }
.first-loading-choice { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid #a8d8cd; border-radius: 12px; background: var(--green-50); cursor: pointer; }
.first-loading-choice input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--green-700); }
.first-loading-choice span { display: grid; gap: 2px; }
.first-loading-choice small { color: var(--muted); font-size: .68rem; }
.note-scope-options .first-loading-preview { display: block; margin-top: 5px; padding: 7px 9px; border-radius: 8px; background: #e6f5f0; color: var(--green-800); font-size: .68rem; font-weight: 800; }
.note-scope-options .first-loading-preview[hidden] { display: none; }
.manual-return { align-self: end; margin-bottom: 1px; }
.notification-permission-button.is-active { border-color: #9ecfc3; background: var(--green-50); color: var(--green-800); opacity: 1; }
.notification-permission-button.is-blocked { border-color: #f1c9c5; background: var(--red-soft); color: var(--red); opacity: 1; }
.notification-setup-hint { margin-top: -10px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.sticky-form-actions { position: sticky; z-index: 20; bottom: 12px; display: flex; justify-content: flex-end; gap: 9px; width: fit-content; margin: 16px 0 0 auto; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); backdrop-filter: blur(12px); }

.driver-load-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.driver-load-list > .panel { margin: 0; }
.driver-load-card { scroll-margin-top: 95px; }
.driver-load-card.is-focused { border-color: #78b8aa; box-shadow: 0 0 0 3px rgba(8, 117, 101, .1), var(--shadow); }
.driver-load-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.driver-load-card > header > div { display: flex; align-items: baseline; gap: 10px; }
.load-time { color: var(--green-800); font-size: 1.7rem; font-weight: 900; line-height: 1; }
.load-date { color: var(--muted); font-size: .78rem; }
.driver-load-card h2 { margin: 18px 0 2px; font-size: 1.18rem; }
.driver-load-card > .muted { margin: 0 0 14px; font-size: .82rem; }
.driver-load-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.driver-load-details > div { padding: 9px 10px; border-radius: 10px; background: var(--canvas); }
.driver-load-details dt { color: var(--muted); font-size: .68rem; }
.driver-load-details dd { margin: 2px 0 0; font-size: .82rem; font-weight: 800; }
.driver-load-note { margin-top: 13px; padding: 12px; border: 1px solid #eddcae; border-radius: 11px; background: #fffaf0; }
.driver-load-note strong { color: var(--amber); font-size: .76rem; }
.driver-load-note p { margin: 4px 0 0; white-space: normal; font-size: .83rem; }
.driver-load-actions { display: flex; gap: 8px; margin-top: 15px; }
.driver-load-actions .button { flex: 1; padding-right: 11px; padding-left: 11px; font-size: .78rem; }
.driver-message-list { display: grid; max-width: 880px; gap: 14px; margin: 0 auto; }
.driver-message-list > .panel { margin: 0; }
.driver-message-card { scroll-margin-top: 95px; }
.driver-message-card.is-focused { border-color: #78b8aa; box-shadow: 0 0 0 3px rgba(8, 117, 101, .1), var(--shadow); }
.driver-message-card.is-today { border-color: #9fd5c8; background: linear-gradient(135deg, #f1fcf8 0%, #e7f7f2 100%); }
.driver-message-card.is-live { animation: live-message-arrival .28s ease-out; }
.driver-message-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.driver-message-card > header h2 { margin: 0 0 3px; font-size: 1rem; }
.driver-message-card > header time { color: var(--muted); font-size: .7rem; }
.driver-message-text { margin: 14px 0; white-space: normal; font-size: .9rem; }
.message-load-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.message-load-summary span { display: flex; min-width: 0; flex-direction: column; padding: 9px 10px; border-radius: 10px; background: var(--canvas); }
.message-load-summary small { color: var(--muted); font-size: .66rem; }
.message-load-summary strong { margin-top: 2px; overflow-wrap: anywhere; font-size: .78rem; }

.date-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; direction: ltr; }
.date-field input, .date-field button { margin-top: 6px; }
.date-field input { text-align: center; }
.date-field input.is-disabled { opacity: .55; }
.jalali-dialog { width: min(390px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 20px; background: transparent; }
.jalali-dialog::backdrop { background: rgba(2, 30, 26, .58); backdrop-filter: blur(3px); }
.jalali-card { padding: 19px; border-radius: 20px; background: white; box-shadow: var(--shadow); direction: rtl; }
.jalali-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.jalali-head > div { display: flex; flex-direction: column; }
.jalali-head strong { color: var(--green-950); font-size: 1.05rem; }
.jalali-head span { color: var(--muted); font-size: .72rem; }
.dialog-x { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--muted); cursor: pointer; font-size: 1.4rem; }
.jalali-nav { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 7px; margin: 18px 0 12px; }
.jalali-nav strong { text-align: center; }
.jalali-nav button { height: 38px; border: 0; border-radius: 10px; background: var(--green-50); color: var(--green-800); cursor: pointer; font-size: 1.4rem; }
.jalali-week, .jalali-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.jalali-week { margin-bottom: 5px; color: var(--muted); font-size: .7rem; text-align: center; }
.jalali-days button, .jalali-blank { aspect-ratio: 1; min-width: 0; }
.jalali-days button { border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; font-size: .82rem; }
.jalali-days button:hover { background: var(--green-50); }
.jalali-days button.today { border-color: #b8d4cd; color: var(--green-800); font-weight: 900; }
.jalali-days button.selected { background: var(--green-700); color: white; font-weight: 900; }
.jalali-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-grid .button { align-self: stretch; }
  .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row { grid-template-columns: auto minmax(150px, .8fr) minmax(180px, 1fr) auto auto; gap: 11px; }
}

@media (max-width: 800px) {
  .map-app { display: block; }
  .map-stage { height: 100vh; height: 100dvh; }
  .map-sidebar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 700;
    width: 100%;
    height: min(82vh, 720px);
    height: min(82dvh, 720px);
    border: 0;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -18px 48px rgba(4, 44, 37, .22);
    transform: translateY(105%);
    transition: transform .25s ease;
  }
  .map-sidebar.open { transform: translateY(0); }
  .sidebar-footer { flex: 0 0 auto; min-height: 70px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: white; }
  .sidebar-footer > * { min-width: 0; }
  .login-icon-link, .install-app-button.icon-only { width: 44px !important; height: 44px !important; flex-basis: 44px !important; }
  .login-icon-link svg, .install-app-button svg { display: block !important; width: 22px !important; height: 22px !important; max-width: 22px !important; max-height: 22px !important; }
  .sidebar-head { padding-top: 18px; }
  .sidebar-head::before { content: ""; position: absolute; top: 8px; right: 50%; width: 44px; height: 4px; border-radius: 999px; background: #cbd7d3; transform: translateX(50%); }
  .mobile-only { display: inline-grid; }
  .open-list-button {
    position: absolute;
    right: 16px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    left: 16px;
    z-index: 650;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 9px 15px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 16px;
    background: var(--green-950);
    color: white;
    box-shadow: 0 12px 32px rgba(4, 43, 36, .35);
    cursor: pointer;
  }
  .open-list-button strong { text-align: right; font-size: .9rem; }
  .count-pill { display: grid; min-width: 32px; height: 32px; padding: 0 7px; place-items: center; border-radius: 10px; background: rgba(255,255,255,.15); }
  .map-message { bottom: 88px; }
  .route-dialog { margin-bottom: max(12px, env(safe-area-inset-bottom)); }
  .dialog-card { border-radius: 22px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 6px; padding: 9px 16px 7px; }
  .brand-mark { width: 34px; height: 34px; }
  .topnav { width: 100%; padding-bottom: 2px; }
  .admin-shell { width: min(100% - 24px, 1180px); padding-top: 22px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading > .button { align-self: flex-start; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid, .import-panel { grid-template-columns: 1fr; }
  .driver-load-list { grid-template-columns: 1fr; }
  .message-load-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .user-permission-summary { grid-column: 2 / -1; }
  .user-status { grid-column: 2; }
  .user-row-actions { grid-column: 3; grid-row: 1; }
  .load-plan-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sticky-form-actions { right: 0; bottom: 8px; width: 100%; margin-right: 0; }
  .sticky-form-actions .button { flex: 1; }
}

@media (max-width: 560px) {
  .route-grid { grid-template-columns: 1fr; }
  .route-option { min-height: 64px; }
  .sidebar-head { padding-right: 16px; padding-left: 16px; }
  .map-filters { padding-right: 14px; padding-left: 14px; }
  .farm-list { padding-right: 8px; padding-left: 8px; }
  .panel { padding: 16px; border-radius: 15px; }
  .users-panel, .new-user-panel { padding: 0; }
  .stat-grid { gap: 9px; }
  .stat-card { min-height: 96px; padding: 14px; }
  .stat-card strong { font-size: 1.65rem; }
  .form-grid, .filter-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .permission-grid { grid-template-columns: 1fr; }
  .form-actions, .heading-actions { flex-direction: column; }
  .form-actions .button, .heading-actions .button { width: 100%; }
  .inline-form, .table-form, .reset-form { align-items: stretch; flex-direction: column; }
  .details-list > div { grid-template-columns: 1fr; gap: 2px; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .button { width: 100%; }
  .date-field { grid-template-columns: 1fr; }
  .date-field .button { margin-top: 0; }
  .driver-load-actions, .sticky-form-actions { flex-direction: column; }
  .driver-load-actions .button, .sticky-form-actions .button { width: 100%; }
  .disease-distance-list { grid-template-columns: 1fr; }
  .disease-distance-row { grid-template-columns: auto minmax(0, 1fr); }
  .disease-distance-value { grid-column: 2; }
  .load-plan-overview { grid-template-columns: 1fr 1fr; gap: 8px; }
  .load-plan-overview > div { min-height: 67px; padding: 11px; }
  .load-plan-overview > div { align-items: flex-start; flex-direction: column; }
  .user-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 13px; }
  .user-permission-summary { display: none; }
  .user-status { grid-column: 2; }
  .user-row-actions { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; }
  .message-load-summary { grid-template-columns: 1fr; }
}

/* Mobile experience: the desktop layout above remains unchanged. */
@media (max-width: 800px) {
  body.admin-body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .desktop-load-only { display: none !important; }

  /* Map drawer */
  .map-sidebar {
    height: min(78vh, 760px);
    height: min(78dvh, 760px);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -20px 55px rgba(4, 44, 37, .24);
  }
  .sidebar-head { min-height: 108px; padding: 27px 20px 14px; }
  .sidebar-head h1 { margin-top: 3px; font-size: 1.85rem; }
  .sidebar-head .eyebrow { font-size: .76rem; }
  .sidebar-head .icon-button { width: 48px; height: 48px; border-radius: 14px; font-size: 1.55rem; }
  .map-mode-switch { margin-right: 16px; margin-left: 16px; }
  .map-mode-switch button { padding-right: 3px; padding-left: 3px; font-size: .7rem; }
  .map-filters { padding: 0 18px 16px; }
  .search-box { min-height: 56px; padding: 0 15px; border-radius: 16px; background: #f8faf9; }
  .search-box input { min-height: 54px; font-size: .91rem; }
  .select-label { grid-template-columns: 54px 1fr; margin-top: 14px; }
  .select-label select { min-height: 52px; border-radius: 14px; font-size: .9rem; }
  .selection-actions { gap: 10px; margin-top: 13px; }
  .selection-actions button { min-height: 48px; border-radius: 13px; font-size: .84rem; }
  .list-summary { padding: 13px 21px 7px; }
  .farm-list { padding: 2px 14px 12px; }
  .farm-row { min-height: 72px; margin: 3px 0; padding: 10px 8px; border-bottom: 1px solid #edf1f0; border-radius: 12px; }
  .farm-row-text strong { font-size: .98rem; }
  .farm-row button { width: 42px; height: 42px; border-radius: 13px; }
  .sidebar-footer { display: flex; min-height: 76px; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .sidebar-footer .install-app-button:not(.icon-only), .sidebar-footer .login-icon-link, .sidebar-footer .map-primary-action {
    display: inline-flex;
    min-height: 50px;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 14px;
    font-size: .86rem;
    font-weight: 900;
  }
  .sidebar-footer .install-app-button:not(.icon-only) { border: 1px solid #a8d8cd; background: white; }
  .sidebar-footer .install-app-button:not(.icon-only) svg, .sidebar-footer .login-icon-link span { display: block !important; }
  .sidebar-footer .login-icon-link, .sidebar-footer .map-primary-action { border: 1px solid var(--green-700); background: var(--green-700); color: white; box-shadow: 0 8px 20px rgba(8, 117, 101, .2); }
  .sidebar-footer .login-icon-link { width: auto !important; flex: 1 1 0 !important; }
  .sidebar-footer .login-icon-link svg { stroke: white; }
  .sidebar-footer .install-app-button.icon-only { height: 50px !important; border-radius: 14px; }
  .open-list-button {
    right: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom));
    left: auto;
    width: min(330px, calc(100% - 32px));
    min-height: 58px;
    border: 0;
    border-radius: 18px;
    background: rgba(4, 61, 53, .96);
    transform: translateX(50%);
  }

  /* Logged-in mobile header */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 48;
    min-height: 70px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    background: rgba(255,255,255,.97);
  }
  .topnav { display: none; }
  .brand { min-width: 0; flex: 1; font-size: 1rem; }
  .brand-mark { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 14px; }
  .mobile-top-actions.mobile-only { display: flex; align-items: center; gap: 7px; }
  .mobile-top-icon { position: relative; display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--green-800); }
  .mobile-top-icon svg, .mobile-load-actions svg, .heading-actions svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-top-icon .notification-count { position: absolute; top: -4px; left: -4px; }
  .mobile-page-back.mobile-only { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--ink); font-size: 2rem; line-height: 1; text-decoration: none; }
  .page-load-plan .mobile-top-actions { display: none !important; }

  .admin-shell { width: 100%; padding: 20px 16px 112px; }
  .page-heading { margin-bottom: 18px; }

  /* Bottom navigation */
  .mobile-app-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    min-height: calc(72px + env(safe-area-inset-bottom));
    padding: 7px 6px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.98);
    box-shadow: 0 -8px 26px rgba(21, 56, 49, .08);
    backdrop-filter: blur(14px);
  }
  .mobile-app-nav a { position: relative; display: flex; min-width: 0; align-items: center; justify-content: center; flex-direction: column; gap: 2px; border-radius: 13px; color: #5d6966; font-size: .66rem; font-weight: 800; text-decoration: none; }
  .mobile-app-nav a::before { content: ""; position: absolute; top: -7px; right: 22%; left: 22%; height: 3px; border-radius: 0 0 4px 4px; background: transparent; }
  .mobile-app-nav a.is-active { background: var(--green-50); color: var(--green-800); }
  .mobile-app-nav a.is-active::before { background: var(--green-700); }
  .mobile-app-nav svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-app-nav .notification-count { position: absolute; top: 2px; left: calc(50% - 22px); min-width: 17px; height: 17px; font-size: .55rem; }

  /* Load-plan file list */
  .load-plans-heading { display: block; text-align: center; }
  .load-plans-heading h1 { margin-top: 2px; font-size: 1.75rem; }
  .load-plans-heading p { margin: 7px auto 0; max-width: 340px; font-size: .84rem; }
  .load-plans-heading .mobile-only { display: inline; }
  .order-api-panel { align-items: stretch; flex-direction: column; gap: 16px; margin-bottom: 18px; padding: 17px; border-radius: 18px; }
  .order-api-copy { grid-template-columns: 106px minmax(0, 1fr); }
  .order-api-badge { min-width: 106px; min-height: 52px; padding: 5px 8px; border-radius: 14px; font-size: .66rem; }
  .order-api-copy h2 { font-size: 1rem; }
  .order-api-copy p { font-size: .72rem; line-height: 1.75; }
  .order-api-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .order-api-actions form { display: contents; }
  .order-api-actions .button { width: 100%; min-width: 0; min-height: 48px; }
  .mobile-load-actions.mobile-only { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 18px; }
  .mobile-load-actions form { display: contents; }
  .mobile-load-actions .button { display: flex; min-width: 0; min-height: 76px; align-items: center; justify-content: center; flex-direction: column; gap: 5px; padding: 8px 4px; border-radius: 14px; font-size: .68rem; line-height: 1.35; text-align: center; white-space: normal; }
  .mobile-section-title { display: flex; align-items: center; gap: 11px; margin-bottom: 15px; }
  .mobile-section-title h2 { margin: 0; font-size: 1.12rem; }
  .mobile-section-title p { margin: 1px 0 0; color: var(--muted); font-size: .72rem; }
  .mobile-section-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 13px; background: var(--green-50); color: var(--green-700); font-size: 1.25rem; font-weight: 900; }
  .mobile-upload-form { display: grid; gap: 10px; }
  .mobile-file-picker { display: flex; min-height: 238px; align-items: center; justify-content: center; flex-direction: column; gap: 7px; padding: 22px; border: 2px dashed #a8d8cd; border-radius: 18px; background: linear-gradient(145deg, #fbfffe, var(--green-50)); cursor: pointer; text-align: center; }
  .excel-file-icon, .batch-file-icon, .mobile-file-summary-icon { display: grid; place-items: center; border-radius: 12px; background: var(--green-700); color: white; font-family: Arial, sans-serif; font-weight: 900; }
  .excel-file-icon { width: 62px; height: 72px; margin-bottom: 7px; font-size: 1.8rem; box-shadow: 0 8px 18px rgba(8,117,101,.18); }
  .mobile-file-picker strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
  .mobile-file-picker small { color: var(--muted); font-size: .72rem; }
  .mobile-file-cta { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px; width: min(230px, 100%); margin-top: 8px; border-radius: 13px; background: var(--green-700); color: white; }
  .mobile-file-cta svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .mobile-upload-submit { width: 100%; }
  .mobile-batch-section.mobile-only { display: block; }
  .mobile-batch-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
  .mobile-batch-heading > div { display: flex; align-items: center; gap: 10px; }
  .mobile-batch-heading h2 { margin: 0; font-size: 1.22rem; }
  .mobile-batch-heading > span { color: var(--muted); font-size: .72rem; }
  .mobile-batch-list { display: grid; gap: 10px; }
  .mobile-batch-card { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 10px; min-height: 84px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: white; color: inherit; box-shadow: 0 5px 18px rgba(31,64,57,.045); text-decoration: none; }
  .batch-file-icon { width: 48px; height: 54px; background: var(--green-50); color: var(--green-700); font-size: 1.15rem; }
  .batch-card-main { display: flex; min-width: 0; flex-direction: column; }
  .batch-card-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .87rem; }
  .batch-card-main small { margin-top: 3px; overflow: hidden; color: var(--muted); font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }

  /* Load-plan detail */
  .page-load-plan { padding-bottom: calc(154px + env(safe-area-inset-bottom)); }
  .page-load-plan .admin-shell { padding-top: 16px; padding-bottom: 176px; }
  .load-plan-heading { gap: 12px; margin-bottom: 14px; }
  .load-plan-file-summary { display: grid; width: 100%; grid-template-columns: 52px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: white; }
  .mobile-file-summary-icon.mobile-only { display: grid; width: 52px; height: 58px; }
  .load-plan-file-summary > div { min-width: 0; }
  .load-plan-file-summary strong.mobile-only { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'IRANYekanXFaNum', Tahoma, sans-serif; font-size: 1rem; }
  .load-plan-file-summary p { margin: 3px 0 0; font-size: .72rem; }
  .load-plan-heading .heading-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .load-plan-heading .heading-actions .button { width: 100%; min-width: 0; min-height: 52px; padding: 7px 8px; border: 1px solid var(--green-700); background: white; color: var(--green-800); font-size: .76rem; }
  .load-plan-heading .heading-actions .mobile-only { display: inline; }
  .load-plan-heading .heading-actions svg.mobile-only { display: block; flex: 0 0 21px; }
  .load-plan-overview { grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; margin-bottom: 13px; }
  .load-plan-overview > div { min-height: 88px; align-items: center; justify-content: center; flex-direction: column; gap: 7px; padding: 8px 5px; border-radius: 14px; text-align: center; }
  .load-plan-overview span { font-size: .65rem; }
  .load-plan-overview strong { font-size: 1.45rem; }
  .load-plan-overview .overview-hot { border-color: #f4d0cc; background: #fff5f4; }
.load-plan-overview .overview-hot strong { color: var(--red); }
  .load-plan-guidance { display: none; }
  .weather-alert { display: flex; align-items: center; min-height: 72px; padding: 14px 16px; border: 1px solid #f2c1bc; font-size: .8rem; }
  .load-lines-panel { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .mobile-load-lines-heading.mobile-only { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
  .mobile-load-lines-heading h2 { margin: 0; font-size: 1.2rem; }
  .mobile-load-lines-heading span { display: block; color: var(--muted); font-size: .7rem; }
  .mobile-load-lines-heading button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--green-800); font-size: 1.35rem; }
  .load-lines-scroll { overflow: visible; }
  .load-line-header { display: none; }
  .load-line-list { gap: 11px; }
  .load-line-row {
    display: grid;
    min-width: 0;
    min-height: 0;
    grid-template-columns: 52px repeat(3, minmax(0,1fr));
    grid-template-areas:
      "index farm farm farm"
      "driver driver time time"
      "hand hand return return"
      "note note note note"
      "delivery delivery delivery delete";
    align-items: stretch;
    gap: 9px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: white;
    box-shadow: 0 5px 18px rgba(31,64,57,.045);
  }
  .load-line-index { grid-area: index; display: grid; min-height: 46px; place-items: center; border-radius: 13px; background: var(--canvas); font-size: 1rem; }
  .load-line-farm { grid-area: farm; grid-template-columns: minmax(0,1fr); gap: 4px; }
  .load-line-farm select { min-height: 46px; padding: 6px 9px; border: 0; background: transparent; font-size: .85rem; font-weight: 900; }
  .load-line-meta { max-width: none; align-items: flex-start; flex-direction: row; flex-wrap: wrap; padding: 0 10px; }
  .load-line-farm small { font-size: .66rem; }
  .weather-badge { max-width: none; }
  .load-control { display: flex; min-width: 0; flex-direction: column; gap: 3px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfc; color: var(--muted); font-size: .62rem; }
  .load-control > span.mobile-only { display: block; }
  .load-control select, .load-control input { min-height: 30px; padding: 0; border: 0; background: transparent; font-size: .79rem; font-weight: 800; }
  .load-driver-control { grid-area: driver; }
  .load-time-control { grid-area: time; }
  .load-time-control input { direction: ltr; text-align: center; }
  .load-hand-control { grid-area: hand; }
  .compact-return-toggle { grid-area: return; }
  .compact-return-toggle span, .load-note-button { min-height: 48px; border-radius: 12px; font-size: .75rem; }
  .load-note-button { grid-area: note; }
  .delivery-state { grid-area: delivery; min-height: 36px; justify-content: center; padding: 4px 9px; border-radius: 10px; background: var(--canvas); }
  .row-delete-button { grid-area: delete; align-self: center; width: 38px; height: 38px; font-size: 0; }
  .row-delete-button::before { content: "⌫"; font-size: 1.15rem; }
  .load-lines-empty { min-width: 0; padding: 24px 12px; }
  .page-load-plan .sticky-form-actions {
    position: fixed;
    right: 0;
    bottom: calc(72px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 47;
    display: grid;
    width: auto;
    grid-template-columns: minmax(0,.9fr) minmax(0,1.25fr);
    gap: 9px;
    margin: 0;
    padding: 10px 14px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255,255,255,.98);
    box-shadow: 0 -8px 24px rgba(22,57,50,.08);
  }
  .page-load-plan .sticky-form-actions .button { width: 100%; min-width: 0; min-height: 52px; padding: 7px 8px; border-radius: 13px; font-size: .74rem; }
  .page-load-plan .sticky-form-actions .mobile-only { display: inline; }
  .management-dialog { margin-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@keyframes live-message-arrival {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 800px) {
  .mobile-app-nav { z-index: 70; }
  .mobile-app-nav > a,
  .mobile-app-nav > button {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 58px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #5d6966;
    font: inherit;
    font-size: .66rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
  }
  .mobile-app-nav > a::before,
  .mobile-app-nav > button::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 22%;
    left: 22%;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: transparent;
  }
  .mobile-app-nav > a.is-active,
  .mobile-app-nav > button.is-active { background: var(--green-50); color: var(--green-800); }
  .mobile-app-nav > a.is-active::before,
  .mobile-app-nav > button.is-active::before { background: var(--green-700); }

  body.mobile-more-open { overflow: hidden; }
  .mobile-more-layer { position: fixed; inset: 0; z-index: 90; }
  .mobile-more-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(2, 30, 26, .48); backdrop-filter: blur(2px); }
  .mobile-more-sheet {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: min(72dvh, 620px);
    overflow-y: auto;
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: white;
    box-shadow: 0 -18px 45px rgba(4, 45, 38, .2);
  }
  .mobile-more-sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  .mobile-more-sheet > header::before { content: ""; position: absolute; top: 7px; right: 50%; width: 38px; height: 4px; border-radius: 999px; background: #d6dfdc; transform: translateX(50%); }
  .mobile-more-sheet h2 { margin: 8px 0 0; font-size: 1rem; }
  .mobile-more-sheet > header button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); font-size: 1.45rem; cursor: pointer; }
  .mobile-more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .mobile-more-item {
    position: relative;
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 10px 8px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--canvas);
    color: #43504d;
    font: inherit;
    font-size: .75rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
  }
  .mobile-more-item svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-more-item.is-active { border-color: #9fd5c8; background: var(--green-50); color: var(--green-800); }
  .mobile-more-item .notification-count { position: absolute; top: 7px; left: 7px; }
  .mobile-nav-danger { color: var(--red) !important; }

  #manualRowDialog.management-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 14px);
    margin: auto 0 0;
    border-radius: 26px 26px 0 0;
  }
  #manualRowDialog::backdrop { background: rgba(5, 34, 29, .58); backdrop-filter: blur(5px); }
  #manualRowDialog .manual-row-card {
    position: relative;
    max-height: calc(100dvh - 14px);
    gap: 18px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 26px 18px calc(18px + env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -18px 50px rgba(3, 47, 39, .2);
  }
  #manualRowDialog .manual-row-card::before {
    content: "";
    position: absolute;
    top: 8px;
    right: 50%;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #d5dfdc;
    transform: translateX(50%);
  }
  #manualRowDialog .manual-dialog-head { align-items: flex-start; padding-top: 5px; }
  #manualRowDialog .manual-dialog-head h2 { margin: 4px 0 0; font-size: 1.35rem; line-height: 1.55; }
  #manualRowDialog .manual-dialog-head p.mobile-only { display: block; margin: 3px 0 0; color: var(--muted); font-size: .72rem; font-weight: 500; }
  #manualRowDialog .manual-dialog-head .icon-button { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; }
  #manualRowDialog .manual-row-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 13px 10px;
  }
  #manualRowDialog .manual-farm-field,
  #manualRowDialog .manual-driver-field,
  #manualRowDialog .manual-return { grid-column: 1 / -1; }
  #manualRowDialog .manual-time-field { grid-column: 1; }
  #manualRowDialog .manual-hand-field { grid-column: 2; }
  #manualRowDialog .manual-field-label { margin: 0 3px 7px; color: #40504c; font-size: .75rem; }
  #manualRowDialog select,
  #manualRowDialog input[type="time"],
  #manualRowDialog input[type="text"],
  #manualRowDialog input[type="number"] {
    min-height: 56px;
    margin-top: 0;
    padding: 10px 13px;
    border-color: #ccd8d5;
    border-radius: 14px;
    background: #fbfcfc;
    font-size: .86rem;
    font-weight: 700;
  }
  #manualRowDialog select:focus,
  #manualRowDialog input:focus { border-color: #63ad9c; outline: 3px solid rgba(8, 117, 101, .11); }
  #manualRowDialog .manual-driver-field select:disabled { background: #eef2f1; color: #9aa5a2; opacity: 1; }
  #manualRowDialog .manual-return { margin: 1px 0 0; }
  #manualRowDialog .manual-return > span {
    position: relative;
    min-height: 58px;
    align-items: flex-start;
    padding: 9px 14px;
    border-radius: 14px;
    background: #f7f9f8;
    text-align: right;
  }
  #manualRowDialog .manual-return > span::after {
    content: "";
    position: absolute;
    left: 15px;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: #cbd5d2;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
  }
  #manualRowDialog .manual-return > span::before {
    content: "";
    position: absolute;
    z-index: 1;
    left: 32px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 5px rgba(20, 50, 44, .18);
    transition: transform .18s ease;
  }
  #manualRowDialog .manual-return input:checked + span { align-items: flex-start; padding-right: 14px; padding-left: 62px; }
  #manualRowDialog .manual-return input:checked + span::after { background: rgba(255,255,255,.32); }
  #manualRowDialog .manual-return input:checked + span::before { transform: translateX(-16px); }
  #manualRowDialog .manual-return strong { font-size: .8rem; }
  #manualRowDialog .manual-return small { font-size: .64rem; }
  #manualRowDialog .manual-row-actions { display: grid; grid-template-columns: 1fr; gap: 9px; margin-top: 0; }
  #manualRowDialog .manual-row-actions .button { width: 100%; min-height: 54px; border-radius: 14px; font-size: .85rem; }
}

/* Farm infrastructure map — refined interface */
.page-farm-map { background: #f5f8f7; }
.page-farm-map .admin-shell { width: min(1480px, calc(100% - 38px)); max-width: none; }
.page-farm-map .facility-page-heading { align-items: flex-end; margin: 8px 0 18px; }
.facility-heading-copy { display: grid; gap: 3px; }
.facility-heading-copy .back-link { display: inline-flex; width: max-content; align-items: center; gap: 4px; margin-bottom: 6px; color: #55706a; font-size: .72rem; font-weight: 800; text-decoration: none; }
.facility-heading-copy .back-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.facility-eyebrow { color: var(--green-700); font-size: .7rem; font-weight: 900; }
.page-farm-map .facility-heading-copy h1 { margin: 0; color: #132c26; font-size: clamp(1.55rem, 2.5vw, 2.25rem); line-height: 1.3; letter-spacing: -.025em; }
.facility-heading-copy p { display: flex; align-items: center; gap: 8px; margin: 3px 0 0; color: #65746f; font-size: .78rem; }
.facility-heading-copy p i { width: 4px; height: 4px; border-radius: 50%; background: #9eadA8; }
.facility-add-primary { display: inline-flex; min-height: 47px; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 13px; box-shadow: 0 9px 24px rgba(8,117,101,.2); }
.facility-add-primary svg,
.facility-editor-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.page-farm-map .facility-workspace { grid-template-columns: minmax(0,1fr) 350px; gap: 16px; min-height: 700px; }
.page-farm-map .facility-map-panel,
.page-farm-map .facility-sidebar,
.page-farm-map .facility-editor { border-color: #d8e3df; border-radius: 21px; box-shadow: 0 14px 38px rgba(26,61,53,.08); }
.page-farm-map .facility-map-panel { background: #d7e2dd; }
.page-farm-map .facility-map { height: 700px; }
.page-farm-map .leaflet-container { font-family: 'IRANYekanXFaNum', Tahoma, sans-serif; }
.page-farm-map .leaflet-control-zoom { overflow: hidden; border: 1px solid rgba(24,64,55,.18); border-radius: 12px; box-shadow: 0 8px 22px rgba(23,55,48,.14); }
.page-farm-map .leaflet-control-zoom a { width: 38px; height: 38px; border: 0; color: #1d3d35; font-size: 21px; line-height: 38px; }
.page-farm-map .leaflet-control-zoom a + a { border-top: 1px solid #e2e9e6; }
.page-farm-map .leaflet-control-attribution { padding: 2px 7px; border-radius: 8px 0 0 0; background: rgba(255,255,255,.82); color: #65736f; font-size: 9px; }
.page-farm-map .leaflet-control-scale-line { border-color: #465953; background: rgba(255,255,255,.82); color: #344741; font-size: 9px; }

.facility-map-actions { top: 16px; right: 16px; gap: 8px; direction: rtl; }
.facility-map-actions button { min-height: 43px; gap: 7px; padding: 7px 12px; border-color: rgba(25,77,65,.14); border-radius: 12px; background: rgba(255,255,255,.95); color: #285a50; font-size: .7rem; box-shadow: 0 7px 20px rgba(15,47,40,.12); backdrop-filter: blur(10px); transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.facility-map-actions button:hover { border-color: #8cc5b7; background: #fff; transform: translateY(-1px); }
.facility-map-actions button.is-active { border-color: #8fcabc; background: #eaf7f3; color: #066A61; }
.facility-map-actions svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.facility-map-key { right: 16px; bottom: 16px; max-width: calc(100% - 32px); gap: 12px; overflow-x: auto; padding: 9px 12px; border: 1px solid rgba(24,67,57,.12); border-radius: 12px; background: rgba(255,255,255,.93); color: #52645f; box-shadow: 0 8px 22px rgba(20,48,41,.1); backdrop-filter: blur(10px); }
.facility-map-key span { flex: 0 0 auto; gap: 6px; font-size: .64rem; white-space: nowrap; }
.facility-map-key i { display: inline-block; box-sizing: border-box; flex: 0 0 auto; border: 0; }
.facility-map-key .key-farm { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: #087F74; box-shadow: 0 0 0 1px #087F74; }
.facility-map-key .key-feature { background: var(--feature-color); }
.facility-map-key .key-point { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--feature-color); }
.facility-map-key .key-linestring { width: 15px; height: 3px; border-radius: 999px; transform: rotate(-22deg); }
.facility-map-key .key-polygon { width: 12px; height: 10px; border: 2px solid var(--feature-color); border-radius: 2px; background: var(--feature-color); opacity: .55; }

.facility-pin-host { border: 0 !important; background: transparent !important; }
.facility-map-pin { display: block; width: 34px; height: 42px; filter: drop-shadow(0 4px 5px rgba(13,43,36,.3)); }
.facility-map-pin svg { display: block; width: 34px; height: 42px; overflow: visible; }
.facility-map-pin .pin-body { fill: var(--pin-color); stroke: #fff; stroke-width: 2; }
.facility-map-pin svg > circle,
.facility-map-pin svg > path:not(.pin-body) { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.facility-map-pin.is-farm { width: 38px; height: 46px; }
.facility-map-pin.is-farm svg { width: 38px; height: 46px; }

.facility-sidebar-head { min-height: 78px; padding: 14px 16px; }
.facility-sidebar-title { display: flex !important; align-items: center; gap: 11px; }
.facility-sidebar-title > i { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 11px; background: #eaf6f2; color: #087F74; }
.facility-sidebar-title > i svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.facility-sidebar-title > span { display: grid; gap: 1px; }
.facility-sidebar-title strong { font-size: .88rem; }
.facility-sidebar-title small { color: #77837f; font-size: .63rem; }
.facility-sidebar-head > button svg,
.facility-editor > header button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.page-farm-map .facility-layer-filter { padding: 13px 14px 12px; background: #f8fbfa; }
.facility-layer-filter input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 18px !important; min-width: 18px; height: 18px !important; min-height: 18px !important; margin: 0; border: 1.5px solid #b9c9c4; border-radius: 5px; background: #fff; box-shadow: none; cursor: pointer; }
.facility-layer-filter input[type="checkbox"]:checked { border-color: #087F74; background-color: #087F74; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m4 10 4 4 8-9' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-position: center; background-repeat: no-repeat; background-size: 14px; }
.page-farm-map .facility-filter-all { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 0 9px; margin: 0 0 9px; padding: 10px 11px; border: 1px solid #dbe7e3; border-radius: 12px; background: #fff; }
.facility-filter-all input { grid-row: 1 / span 2; align-self: center; }
.facility-filter-all span { color: #27463e; font-size: .72rem; font-weight: 900; }
.facility-filter-all small { color: #7a8783; font-size: .58rem; font-weight: 500; }
.facility-layer-filter > div { max-height: 164px; gap: 3px; }
.facility-layer-filter > div label { grid-template-columns: 18px 11px minmax(0,1fr) auto; min-height: 34px; gap: 8px; padding: 5px 8px; border-radius: 9px; }
.facility-layer-filter > div label:hover { background: #eef6f3; }
.facility-layer-filter i,
.facility-list-item i { width: 10px; height: 10px; box-shadow: 0 0 0 3px rgba(41,82,72,.08); }
.facility-layer-filter > div label span { color: #40534d; font-size: .68rem; font-weight: 800; }
.facility-layer-filter b { min-width: 22px; padding: 2px 6px; background: #eaf0ee; color: #52645f; }

.facility-list { gap: 8px; padding: 12px; }
.facility-list-item { min-height: 62px; gap: 7px; padding: 8px 9px; border-color: #edf1ef; border-radius: 13px; background: #fff; }
.facility-list-item:hover { border-color: #c8ddd7; box-shadow: 0 6px 16px rgba(25,65,56,.06); }
.facility-list-item.is-selected { border-color: #83c2b3; background: #eef9f6; box-shadow: 0 0 0 2px rgba(8,117,101,.06); }
.facility-list-item > button { gap: 10px; }
.facility-list-item > button strong { font-size: .73rem; }
.facility-list-item > button small { font-size: .59rem; }
.facility-list-item > div { gap: 2px; }
.facility-list-item > div button { display: grid; width: 30px; height: 30px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 8px; }
.facility-list-item > div button:hover { border-color: #cde0da; background: #f0f7f5; }
.facility-list-item > div form button:hover { border-color: #f0d0cc; background: #fff2f0; }
.facility-list-item > div svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.facility-editor-backdrop { position: absolute; z-index: 880; inset: 0; border: 0; border-radius: 21px; background: rgba(11,31,27,.28); backdrop-filter: blur(2px); cursor: default; }
.facility-editor-backdrop[hidden] { display: none; }
.page-farm-map .facility-editor { z-index: 900; top: 16px; right: 16px; width: min(455px, calc(100% - 32px)); max-height: calc(100% - 32px); border-radius: 19px; box-shadow: 0 24px 70px rgba(7,35,29,.28); }
.facility-editor > header { min-height: 74px; padding: 13px 16px; border-bottom-color: #e2e9e6; }
.facility-editor > header span { font-size: .62rem; letter-spacing: .01em; }
.facility-editor > header h2 { font-size: 1.03rem; }
.facility-editor > header button,
.facility-sidebar-head > button { display: grid; width: 38px; height: 38px; place-items: center; padding: 0; border-radius: 11px; }
.facility-editor form { padding: 15px 16px 17px; }
.facility-form-grid { gap: 12px 10px; }
.facility-form-grid > label { gap: 6px; color: #385048; font-size: .68rem; }
.facility-form-grid input,
.facility-form-grid select,
.facility-form-grid textarea { min-height: 45px; padding: 8px 11px; border-color: #d4dfdb; border-radius: 11px; background-color: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.facility-form-grid input:focus,
.facility-form-grid select:focus,
.facility-form-grid textarea:focus { border-color: #63ae9d; outline: 0; box-shadow: 0 0 0 3px rgba(8,117,101,.09); }
.facility-form-grid textarea { min-height: 88px; }
.facility-draw-picker { padding: 11px; border-color: #d6e2de; border-radius: 14px; background: #fafcfb; }
.facility-draw-picker legend { font-size: .68rem; }
.facility-draw-picker > div { gap: 8px; }
.facility-draw-picker button { min-height: 72px; align-items: center; justify-content: flex-start; gap: 8px; padding: 9px; border-color: #dce5e2; border-radius: 12px; background: #fff; text-align: right; }
.facility-draw-picker button:hover { border-color: #99cbbf; background: #f4fbf8; }
.facility-draw-picker button.is-recommended { border-color: #80c0b1; background: #ebf8f4; box-shadow: 0 0 0 2px rgba(8,117,101,.06); }
.facility-draw-picker button svg { width: 24px; height: 24px; flex: 0 0 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.facility-draw-picker button > span { display: grid; gap: 1px; }
.facility-draw-picker button strong { color: #294840; font-size: .69rem; }
.facility-draw-picker button small { color: #82908c; font-size: .52rem; font-weight: 500; }
.facility-draw-picker p { display: flex; min-height: 31px; align-items: center; margin: 9px 0 0; padding: 6px 9px; border-radius: 8px; background: #eef3f1; font-size: .61rem; }
.facility-draw-picker p.has-geometry { background: #e7f6f1; }
.facility-editor-actions { gap: 9px; margin-top: 16px; }
.facility-editor-actions .button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 7px; border-radius: 12px; }
.facility-editor-actions .button:first-child { flex: 1.5; }
.facility-editor-actions .button:last-child { flex: 1; }

.facility-drawing-bar { right: 50%; bottom: 18px; width: auto; max-width: calc(100% - 32px); min-height: 56px; gap: 7px; padding: 8px 9px 8px 12px; border-color: rgba(20,70,59,.16); border-radius: 15px; }
.facility-drawing-bar strong { min-width: 175px; font-size: .68rem; }
.facility-drawing-bar button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 5px; padding: 6px 9px; border-radius: 10px; }
.facility-drawing-bar button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.facility-mobile-add.mobile-only { display: none; place-items: center; }
.facility-mobile-add svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; }

@media (max-width: 900px) {
  .page-farm-map .admin-shell { width: min(100% - 24px, 900px); }
  .page-farm-map .facility-workspace { grid-template-columns: minmax(0,1fr); min-height: 0; }
  .page-farm-map .facility-map { height: min(68vh, 650px); min-height: 520px; }
}

@media (max-width: 680px) {
  .page-farm-map .admin-shell { width: 100%; padding: 8px 10px calc(92px + env(safe-area-inset-bottom)); }
  .page-farm-map .facility-page-heading { margin: 5px 4px 12px; }
  .page-farm-map .facility-heading-copy h1 { font-size: 1.3rem; }
  .facility-heading-copy .back-link { margin-bottom: 2px; }
  .facility-heading-copy p { font-size: .66rem; }
  .facility-add-primary { display: none; }
  .page-farm-map .facility-map-panel { border-radius: 18px; }
  .page-farm-map .facility-map { height: calc(100dvh - 222px); min-height: 460px; }
  .facility-map-actions { top: 10px; right: 10px; gap: 6px; }
  .facility-map-actions button { width: 42px; height: 42px; min-height: 42px; padding: 0; }
  .facility-map-actions button span { display: none; }
  .facility-map-actions svg { width: 19px; height: 19px; }
  .facility-map-key { display: none; }
  .page-farm-map .facility-sidebar { right: 9px; bottom: calc(78px + env(safe-area-inset-bottom)); left: 9px; display: none; max-height: min(70dvh, 610px); border-radius: 22px; }
  .page-farm-map .facility-sidebar.is-open { display: flex; }
  .facility-sidebar-head { min-height: 70px; }
  .facility-editor-backdrop { position: fixed; z-index: 940; border-radius: 0; }
  .page-farm-map .facility-editor { position: fixed; z-index: 950; top: auto; right: 7px; bottom: calc(7px + env(safe-area-inset-bottom)); width: calc(100% - 14px); max-height: 89dvh; border-radius: 23px; }
  .facility-form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .facility-draw-picker button { min-height: 74px; flex-direction: column; justify-content: center; gap: 4px; padding: 6px 4px; text-align: center; }
  .facility-draw-picker button > span { text-align: center; }
  .facility-drawing-bar { bottom: 12px; display: grid; width: calc(100% - 20px); max-width: none; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; padding: 9px; }
  .facility-drawing-bar strong { grid-column: 1 / -1; min-width: 0; margin: 0; text-align: center; }
  .facility-drawing-bar button { padding: 5px 3px; font-size: .58rem; }
  .facility-drawing-bar button svg { width: 14px; height: 14px; }
  .facility-mobile-add.mobile-only { display: grid; right: 16px; bottom: calc(83px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 17px; }
}

/* Confine Leaflet's high-z-index panes below the sticky site navigation. */
.page-farm-map .facility-map-panel { z-index: 0; isolation: isolate; }
.page-farm-map .facility-workspace { --facility-map-height: clamp(430px, calc(100dvh - 180px), 700px); min-height: 0; }
.page-farm-map .facility-map { height: var(--facility-map-height); min-height: 0; }
.page-farm-map .facility-sidebar { max-height: var(--facility-map-height); }
.select-label[hidden] { display: none; }
.driver-gps-box[hidden] { display: none !important; }
.driver-message-card.is-message { border-right: 4px solid #087F74; }
.driver-message-card.is-alert { border-right: 4px solid #d97706; }
.driver-message-card.is-alert.is-today { background: linear-gradient(135deg, #fffaf0, #fff3da); border-color: #e8b561; }
.message-kind { display: inline-flex; width: fit-content; align-items: center; margin-bottom: 7px; padding: 3px 9px; border-radius: 999px; font-size: .66rem; font-weight: 900; }
.message-kind.kind-message { background: #e3f5ef; color: #066A61; }
.message-kind.kind-alert { background: #fff0d6; color: #945607; }
.message-kind::before { display: inline-block; margin-left: 5px; font-size: .82rem; line-height: 1; }
.message-kind.kind-message::before { content: '✉'; }
.message-kind.kind-alert::before { content: '●'; }
@media (max-width: 900px) {
  .page-farm-map .facility-workspace { --facility-map-height: clamp(420px, 68dvh, 650px); }
}
@media (max-width: 680px) {
  .load-schedule-card { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 17px; }
  .load-schedule-fields { grid-template-columns: 1fr; }
  .schedule-date-field { grid-template-columns: minmax(0, 1fr) auto; }
  .schedule-date-field button { padding-inline: 10px; font-size: .72rem; }
  .page-farm-map .facility-workspace { --facility-map-height: max(420px, calc(100dvh - 222px)); }
  .page-farm-map .facility-sidebar { max-height: min(70dvh, 610px); }
}

/* Searchable, keyboard-friendly select controls. Native selects remain in the form. */
.search-select { display: block; position: relative; width: 100%; margin-top: 6px; }
.search-select > select { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.search-select-trigger { display: flex; width: 100%; min-width: 0; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; overflow: hidden; border: 1px solid #cbdad5; border-radius: 11px; background: #fff; color: #203b33; font: inherit; font-size: .85rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.search-select-trigger::after { content: '⌄'; flex: 0 0 auto; color: #087F74; font-size: 1.25rem; line-height: .8; }
.search-select-trigger:focus-visible { outline: 3px solid rgba(8,117,101,.2); border-color: #087F74; }
.search-select-trigger:disabled { opacity: .55; cursor: not-allowed; }
.search-select-popover { position: fixed; z-index: 3000; display: flex; flex-direction: column; padding: 8px; border: 1px solid #bdd5cd; border-radius: 14px; background: #fff; box-shadow: 0 16px 45px rgba(6,42,33,.22); direction: rtl; }
.search-select-popover[hidden] { display: none; }
.search-select-popover input { margin: 0 0 7px; min-height: 39px; border-radius: 9px; }
.search-select-options { display: grid; gap: 3px; overflow-y: auto; }
.search-select-options button { width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: #27453d; font: inherit; font-size: .82rem; text-align: right; cursor: pointer; }
.search-select-options button:hover, .search-select-options button[aria-selected="true"] { background: #e9f7f2; color: #066A61; }
.search-select-options button:disabled { opacity: .45; }
.search-select-options p { padding: 8px; color: #65746f; font-size: .8rem; }
.load-control .search-select, .load-line-farm .search-select { margin: 0; }
.load-control .search-select-trigger, .load-line-farm .search-select-trigger { min-height: 38px; padding: 5px 7px; font-size: .72rem; }
.facility-form-grid .search-select { margin-top: 0; }

.sms-fallback-settings { display: flex; align-items: end; gap: 16px; margin: 14px 0; padding: 14px 17px; border: 1px solid #c9e1d9; border-radius: 16px; background: #f2faf7; }
.sms-fallback-settings > div { display: grid; flex: 1; gap: 4px; }
.sms-fallback-settings strong { color: #066A61; font-size: .86rem; }
.sms-fallback-settings small { color: #51665f; font-size: .7rem; line-height: 1.8; }
.sms-fallback-settings label { width: 140px; flex: 0 0 140px; font-size: .7rem; font-weight: 800; }
.sms-fallback-settings input { margin-top: 5px; }

/* Full-viewport farm infrastructure workspace; layer drawer starts closed. */
.page-farm-map .admin-shell { width: 100%; max-width: none; padding: 0 10px 10px; }
.page-farm-map .facility-page-heading { min-height: 62px; margin: 0; padding: 6px 10px; }
.page-farm-map .facility-heading-copy { display: flex; align-items: center; gap: 12px; }
.page-farm-map .facility-heading-copy h1 { font-size: 1.05rem; }
.page-farm-map .facility-heading-copy p { margin: 0; }
.page-farm-map .facility-eyebrow { display: none; }
.page-farm-map .facility-workspace { display: block; min-height: 0; --facility-map-height: calc(100dvh - 140px); }
.page-farm-map .facility-map-panel { width: 100%; height: var(--facility-map-height); min-height: 440px; border-radius: 16px; }
.page-farm-map .facility-map { height: 100%; }
.page-farm-map .facility-sidebar { position: absolute; z-index: 800; top: 12px; right: 12px; display: none; width: min(350px, calc(100% - 24px)); height: calc(100% - 24px); max-height: none; background: #fff; box-shadow: 0 18px 50px rgba(6,42,33,.24); }
.page-farm-map .facility-sidebar.is-open { display: flex; }
.page-farm-map .facility-sidebar-head > button { display: grid; }
.page-farm-map .leaflet-container, .page-farm-map .leaflet-popup-content { font-family: inherit; }
.page-farm-map .facility-map.is-drawing .leaflet-interactive, .page-farm-map .facility-map.is-drawing .leaflet-marker-icon { pointer-events: none !important; }
.facility-map-actions { left: 65px; right: auto; }
.facility-map-actions button[data-new-feature] { background: #087F74; color: #fff; }
.facility-popup-interior { width: 100%; margin-top: 8px; padding: 9px; border: 0; border-radius: 9px; background: #e6f5f0; color: #066A61; font: inherit; font-weight: 800; cursor: pointer; }
.facility-tile-warning { position: absolute; z-index: 750; right: 14px; bottom: 45px; left: 14px; width: fit-content; max-width: 80%; margin: 0 auto; padding: 9px 12px; border-radius: 10px; background: #fff5de; color: #78500b; font-size: .7rem; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.facility-tile-warning[hidden] { display: none; }
.facility-categories { padding: 10px 13px; border-bottom: 1px solid #e2e9e6; }
.facility-categories summary { color: #066A61; font-size: .75rem; font-weight: 900; cursor: pointer; }
.facility-category-list { display: grid; max-height: 150px; gap: 4px; overflow: auto; margin: 8px 0; }
.facility-category-list form { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.facility-category-list span { font-size: .68rem; }
.facility-category-list span::before { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--feature-color); content: ''; }
.facility-category-list button, .facility-category-add button { border: 0; border-radius: 7px; background: #e9f6f1; color: #066A61; font: inherit; font-size: .64rem; cursor: pointer; }
.facility-category-add { display: grid; grid-template-columns: minmax(0,1fr) 42px; gap: 5px; }
.facility-category-add input, .facility-category-add .search-select { min-width: 0; margin: 0; }
.facility-category-add input[type=color] { width: 42px; padding: 2px; }
.facility-category-add button { min-height: 40px; }

@media (max-width: 680px) {
  .sms-fallback-settings { flex-wrap: wrap; }
  .sms-fallback-settings > div { flex-basis: 100%; }
  .page-farm-map .admin-shell { padding: 0 5px 80px; }
  .page-farm-map .facility-page-heading { min-height: 52px; }
  .page-farm-map .facility-heading-copy h1 { font-size: .82rem; }
  .page-farm-map .facility-heading-copy p { display: none; }
  .page-farm-map .facility-workspace { --facility-map-height: calc(100dvh - 190px); }
  .page-farm-map .facility-map-panel { min-height: 380px; }
  .page-farm-map .facility-sidebar { position: absolute; top: 8px; right: 8px; bottom: 8px; left: auto; width: min(350px, calc(100% - 16px)); height: auto; max-height: none; }
  .facility-map-actions { top: 10px; right: 10px; left: auto; flex-wrap: wrap; max-width: calc(100% - 75px); }
}

/* v34 — infrastructure map layout. Scoped to this page; the site header is untouched. */
body.page-farm-map { display: flex; height: 100dvh; min-height: 0; flex-direction: column; overflow: hidden; }
.page-farm-map .topbar { flex: 0 0 auto; }
.page-farm-map .admin-shell { display: flex; width: 100%; min-height: 0; flex: 1 1 auto; flex-direction: column; overflow: hidden; padding: 0 16px 16px; }
.page-farm-map .facility-page-heading { display: flex; min-height: 90px; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 9px 2px; }
.page-farm-map .facility-heading-copy { display: grid; gap: 2px; text-align: right; }
.page-farm-map .facility-heading-copy h1 { font-size: clamp(1.15rem, 1.55vw, 1.65rem); }
.page-farm-map .facility-heading-copy p { display: block; font-size: .73rem; }
.facility-toolbar { display: flex; align-items: center; gap: 9px; direction: rtl; }
.facility-toolbar > button, .facility-toolbar-link { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid #d9e4e0; border-radius: 12px; background: #fff; color: #185a4c; font: inherit; font-size: .82rem; font-weight: 800; text-decoration: none; box-shadow: 0 3px 12px rgba(17,58,47,.04); cursor: pointer; }
.facility-toolbar > button:hover, .facility-toolbar-link:hover { border-color: #8bc4b4; background: #f2faf7; }
.facility-toolbar > .facility-toolbar-add { border-color: #087F74; background: #087F74; color: #fff; }
.facility-toolbar > .facility-toolbar-add:hover { background: #06685a; color: #fff; }
.facility-toolbar svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-farm-map .facility-workspace { display: grid; min-height: 0; flex: 1 1 auto; grid-template-columns: minmax(0,1fr) minmax(315px,350px); gap: 16px; --facility-map-height: 100%; }
.page-farm-map .facility-workspace:not(.is-sidebar-open) { grid-template-columns: minmax(0,1fr); }
.page-farm-map .facility-map-panel { width: 100%; height: 100%; min-height: 0; border-radius: 17px; }
.page-farm-map .facility-map { width: 100%; height: 100%; min-height: 0; }
.page-farm-map .facility-map-panel:fullscreen, .page-farm-map .facility-map-panel.is-faux-fullscreen { position: fixed; z-index: 3000; inset: 0; width: 100vw; height: 100dvh; border-radius: 0; }
.page-farm-map .facility-map-panel:fullscreen .facility-map, .page-farm-map .facility-map-panel.is-faux-fullscreen .facility-map { height: 100%; }
.page-farm-map .facility-map-actions { top: 16px; right: 16px; left: auto; }
.page-farm-map .facility-map-actions button { width: 44px; height: 44px; min-height: 44px; padding: 9px; }
.page-farm-map .facility-sidebar { position: relative; z-index: 1; top: auto; right: auto; bottom: auto; left: auto; display: none; width: auto; height: 100%; min-height: 0; max-height: none; border-radius: 17px; box-shadow: 0 8px 24px rgba(19,55,45,.06); }
.page-farm-map .facility-sidebar.is-open { display: flex; }
.page-farm-map .facility-sidebar-head { display: flex; min-height: 72px; flex: 0 0 auto; flex-direction: row-reverse; gap: 9px; padding: 11px 13px; }
.page-farm-map .facility-sidebar-head > button { display: grid; width: 31px; height: 38px; flex: 0 0 31px; place-items: center; border: 0; color: #087F74; font-size: 1.65rem; }
.facility-sidebar-tabs { display: grid; min-width: 0; flex: 1; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; padding: 4px; border-radius: 11px; background: #f3f6f5; }
.facility-sidebar-tabs button { min-width: 0; border: 0; border-radius: 8px; background: transparent; color: #465b53; font: inherit; font-size: .76rem; font-weight: 800; cursor: pointer; }
.facility-sidebar-tabs button.is-active { background: #087F74; color: #fff; box-shadow: 0 2px 7px rgba(8,117,101,.18); }
.page-farm-map .facility-sidebar-panel { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.page-farm-map .facility-sidebar-panel[hidden] { display: none !important; }
.page-farm-map .facility-layers-panel { display: block; }
.page-farm-map .facility-layer-filter { padding: 16px; background: #fff; }
.page-farm-map .facility-filter-all { margin-bottom: 12px; }
.page-farm-map .facility-layer-filter > div { max-height: none; overflow: visible; gap: 4px; }
.page-farm-map .facility-layer-filter > div label { min-height: 42px; font-size: .74rem; }
.page-farm-map .facility-categories { margin-top: 8px; }
.page-farm-map .facility-list { align-content: start; padding: 13px; }
.page-farm-map .facility-editor { position: relative; z-index: auto; top: auto; right: auto; bottom: auto; left: auto; display: block; width: 100%; height: auto; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
.page-farm-map .facility-editor[hidden] { display: none; }
.page-farm-map .facility-editor > header { min-height: 66px; }
.page-farm-map .facility-editor form { padding: 14px; }
.page-farm-map .facility-form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.page-farm-map .facility-draw-picker > div { grid-template-columns: repeat(3,minmax(0,1fr)); }
.page-farm-map .facility-draw-picker button { min-height: 72px; }
.facility-details { padding: 18px; }
.facility-details .empty-state { color: #74857e; font-size: .78rem; line-height: 1.9; text-align: center; }
.facility-detail-title { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.facility-detail-title i { width: 13px; height: 13px; flex: 0 0 13px; border-radius: 50%; background: var(--feature-color); }
.facility-detail-title h2 { margin: 0; color: #19392f; font-size: 1rem; }
.facility-details dl { display: grid; gap: 0; margin: 0; }
.facility-details dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e7eeeb; font-size: .76rem; }
.facility-details dt { color: #687b72; }
.facility-details dd { margin: 0; color: #1e4236; font-weight: 800; text-align: left; }
.facility-detail-notes { margin-top: 18px; padding: 13px; border-radius: 11px; background: #f1f8f5; color: #284d40; font-size: .75rem; line-height: 1.9; }
.facility-detail-notes p { margin: 6px 0 0; }
@media (max-width: 850px) {
  .page-farm-map .admin-shell { padding: 0 8px calc(77px + env(safe-area-inset-bottom)); }
  .page-farm-map .facility-page-heading { min-height: 68px; gap: 6px; padding: 5px 3px; }
  .page-farm-map .facility-heading-copy h1 { font-size: .92rem; }
  .page-farm-map .facility-heading-copy p { display: none; }
  .facility-toolbar { gap: 4px; }
  .facility-toolbar > button, .facility-toolbar-link { min-height: 44px; padding: 6px 9px; font-size: .68rem; }
  .facility-toolbar > [data-fit-features], .facility-toolbar-link { width: 44px; padding: 0; }
  .facility-toolbar .facility-action-label { display: none; }
  .facility-toolbar svg { width: 16px; height: 16px; }
  .page-farm-map .facility-workspace { position: relative; display: block; min-height: 0; }
  .page-farm-map .facility-map-panel { width: 100%; height: 100%; min-height: 0; }
  .page-farm-map .facility-sidebar { position: absolute; z-index: 850; top: 8px; right: 8px; bottom: 8px; left: auto; width: min(350px,calc(100% - 16px)); height: auto; max-height: none; }
  .page-farm-map .facility-map-actions { top: 10px; right: 10px; }
  .page-farm-map .facility-drawing-bar { bottom: 10px; }
}
@media (max-width: 420px) {
  .page-farm-map .facility-page-heading { min-height: 106px; flex-wrap: wrap; align-content: center; }
  .page-farm-map .facility-heading-copy { min-width: 0; }
  .page-farm-map .facility-heading-copy h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-farm-map .facility-toolbar { width: 100%; }
}

/* Use the supplied IRANYekan X FaNum typeface throughout the site, including Leaflet popups. */
.farm-popup, .page-farm-map .leaflet-container,
.load-plan-file-summary strong.mobile-only,
.excel-file-icon, .batch-file-icon, .mobile-file-summary-icon {
  font-family: 'IRANYekanXFaNum', Tahoma, "Segoe UI", Arial, sans-serif;
}
.farm-location-picker { display: grid; gap: 9px; padding: 14px; border: 1px solid #cbded7; border-radius: 14px; background: #f7fbf9; }
.farm-location-picker > div:first-child { display: grid; gap: 4px; }
.farm-location-picker strong { color: #066A61; }
.farm-location-picker small { color: #60716b; line-height: 1.8; }
.farm-location-map { width: 100%; height: clamp(300px, 48vh, 500px); overflow: hidden; border: 1px solid #cbded7; border-radius: 12px; background: #dce6e1; }
.farm-location-map .leaflet-container { font-family: 'IRANYekanXFaNum', Tahoma, sans-serif; }
.farm-location-open { justify-self: start; }
.farm-location-dialog { width: min(960px, calc(100% - 20px)); }
.farm-location-dialog .dialog-card { display: grid; max-height: calc(100dvh - 28px); gap: 12px; overflow-y: auto; }
.farm-location-dialog .farm-location-map { height: min(62dvh, 620px); min-height: 280px; }
.farm-location-pin-wrap { background: transparent; border: 0; }
.farm-location-pin { display: grid; width: 38px; height: 38px; place-items: center; border: 3px solid white; border-radius: 50%; background: var(--green-700); box-shadow: 0 3px 11px rgba(0,0,0,.35); color: white; font-size: 24px; font-weight: 900; }
.mobile-upload-dialog .mobile-load-upload { display: grid; gap: 15px; max-height: calc(100dvh - 28px); overflow-y: auto; }
.mobile-upload-dialog .mobile-file-picker { min-height: 210px; }
.load-batch-actions { display: flex; align-items: center; gap: 10px; }
.load-batch-actions form, .mobile-batch-entry form { margin: 0; }
.load-batch-delete { border: 0; background: transparent; color: var(--red); cursor: pointer; font: inherit; font-size: .72rem; font-weight: 800; }
.load-batch-delete:hover { text-decoration: underline; }
.mobile-batch-entry { display: grid; gap: 3px; }
.mobile-batch-entry > form { justify-self: end; padding: 0 8px 3px; }
.farm-mobile-only { display: none; }
@media (max-width: 800px) {
  .farm-list-table th:nth-child(2), .farm-list-table th:nth-child(3), .farm-list-table th:nth-child(4),
  .farm-list-table td:nth-child(2), .farm-list-table td:nth-child(3), .farm-list-table td:nth-child(4),
  .farm-list-table .farm-desktop-only { display: none !important; }
  .farm-list-table .farm-mobile-only { display: inline; }
  .farm-list-table .farm-mobile-meta { display: block; margin-top: 5px; color: var(--muted); font-size: .7rem; }
  .farm-list-table th:last-child, .farm-list-table td:last-child { width: auto; }
  .farm-list-table td.actions-cell { justify-content: flex-end; }
}
.load-line-farm .load-add-farm { color: #066A61; font-size: .66rem; font-weight: 800; text-decoration: underline; white-space: nowrap; }

/* v37 — vehicles own GPS links; the driver is a replaceable assignment. */
.vehicle-page-heading { align-items: center; }
.vehicle-panel { overflow: hidden; }
.vehicle-list { display: grid; }
.vehicle-row { display: grid; grid-template-columns: 48px minmax(150px,1.4fr) minmax(125px,1fr) minmax(170px,1fr) auto; align-items: center; gap: 15px; padding: 15px 19px; border-top: 1px solid #e5eeea; }
.vehicle-symbol { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 12px; background: #eaf8f3; color: #087F74; }
.vehicle-symbol svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vehicle-identity, .vehicle-driver, .vehicle-gps { display: grid; gap: 5px; min-width: 0; }
.vehicle-identity strong, .vehicle-driver strong { overflow: hidden; color: #173b31; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-row small, .vehicle-driver span { color: #647a71; font-size: .7rem; }
.vehicle-gps .badge { justify-self: start; }
.vehicle-error { color: #ad3b35 !important; }
.vehicle-empty { padding: 20px; color: #647a71; }
.vehicle-dialog-card { display: grid; width: min(620px,100%); max-height: calc(100dvh - 30px); gap: 14px; overflow-y: auto; }
.vehicle-dialog-card .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.vehicle-dialog-card .form-grid label { min-width: 0; }
@media (max-width: 800px) {
  .vehicle-page-heading { align-items: stretch; }
  .vehicle-row { grid-template-columns: 38px minmax(0,1fr) auto; gap: 9px; padding: 13px; }
  .vehicle-symbol { width: 38px; height: 38px; }
  .vehicle-driver, .vehicle-gps { grid-column: 2 / 4; }
  .vehicle-driver { display: flex; gap: 7px; }
  .vehicle-gps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .vehicle-row > button { grid-column: 3; grid-row: 1; }
  .vehicle-dialog-card .form-grid { grid-template-columns: 1fr; }
}

/* SMS and temporary destination links. */
.sms-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,410px),1fr)); gap:18px; align-items:start; }
.sms-panel { padding:22px; }
.sms-panel h2 { margin:0 0 8px; }
.sms-panel .form-stack { margin-top:18px; }
.sms-panel textarea { resize:vertical; }
.sms-recipient-list { max-height:300px; overflow:auto; border:1px solid #dbe8e3; border-radius:14px; }
.sms-recipient { display:flex !important; align-items:center; gap:10px; padding:10px 12px; border-bottom:1px solid #edf2ef; cursor:pointer; }
.sms-recipient[hidden] { display:none !important; }
.sms-recipient:last-child { border-bottom:0; }
.sms-recipient input,.sms-consent input { width:18px; height:18px; flex:none; accent-color:#087F74; }
.sms-recipient span { display:grid; gap:3px; }
.sms-recipient small { color:#667c75; }
.sms-select-actions { display:flex; flex-wrap:wrap; gap:8px; }
.sms-select-actions button { border:1px solid #cfe0da; border-radius:9px; background:#eef7f3; color:#096858; padding:8px 11px; cursor:pointer; font:inherit; }
.sms-consent { display:flex !important; flex-direction:row !important; gap:9px; align-items:center; line-height:1.7; }
.sms-history { margin-top:18px; }
.sms-batch-list { display:grid; gap:0; }
.sms-batch { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; padding:15px 0; border-top:1px solid #edf2ef; }
.sms-batch > div:first-child { display:grid; gap:4px; }
.sms-batch small { color:#6a7e77; }
.sms-batch-status { color:#2b6255; font-size:.85rem; }
@media(max-width:600px){.sms-panel{padding:16px}.sms-batch{align-items:stretch}.sms-batch form{width:100%}.sms-batch button{width:100%}}
.farm-share-list { margin-top:16px; border-top:1px solid #e4efea; padding-top:14px; }
.farm-share-list summary { cursor:pointer; font-weight:700; color:#0b6e5f; }
.farm-share-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px solid #eef3f0; font-size:.82rem; }
@media(max-width:600px){.farm-share-row{align-items:stretch;flex-direction:column}}
.driver-panel { margin-top:18px; }
.driver-row { display:grid; grid-template-columns:42px minmax(140px,1fr) minmax(130px,auto) auto auto; align-items:center; gap:14px; padding:14px 20px; border-top:1px solid #e5eeea; }
.driver-row .user-avatar { display:grid; place-items:center; width:38px; height:38px; border-radius:50%; background:#e9f7f2; color:#087F74; }
.driver-row .user-avatar svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.7; }
.driver-phone { color:#52746a; font-size:.82rem; }
.driver-password-form { border-top:1px solid #e4efea; margin-top:8px; padding-top:16px; }
@media(max-width:700px){.driver-row{grid-template-columns:38px minmax(0,1fr) auto;gap:8px;padding:12px}.driver-phone{grid-column:2}.driver-row>.badge{grid-column:3;grid-row:1}.driver-row>button{grid-column:3;grid-row:2}}

/* v40 — two management tabs and guest-driver workflow. */
.vehicle-tabs{display:flex;gap:8px;margin:16px 0;border-bottom:1px solid #d9e6e1;padding-bottom:8px}
.vehicle-tabs button{display:flex;align-items:center;gap:8px;border:1px solid transparent;border-radius:12px;background:transparent;color:#49665c;padding:11px 17px;font:inherit;font-weight:800;cursor:pointer}
.vehicle-tabs button[aria-selected="true"]{background:#087F74;color:#fff;box-shadow:0 5px 15px #087F7420}
.vehicle-tabs small{display:grid;place-items:center;min-width:24px;height:24px;border-radius:999px;background:#e5f3ef;color:#066A61;font-size:.72rem}
.vehicle-tabs button[aria-selected="true"] small{background:#ffffff38;color:#fff}
.vehicle-panel[hidden]{display:none!important}
.vehicle-panel .panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px}
.driver-panel{margin-top:0}
.guest-driver-card{display:grid;gap:14px;width:min(430px,100%)}
.guest-driver-card label{display:grid;gap:6px;font-weight:700}
.sms-template-heading{display:flex;align-items:center;justify-content:space-between;gap:10px}
.sms-template-heading label{font-weight:700}
.sms-code-help{border:1px solid #c8e1d8;background:#eff8f4;color:#076956;border-radius:9px;padding:7px 10px;font:inherit;font-size:.78rem;font-weight:700;cursor:pointer}
.sms-code-dialog{max-width:470px}
.sms-code-dialog li{margin:7px 0}.sms-code-dialog code{direction:ltr;display:inline-block;background:#ecf6f2;border-radius:6px;padding:2px 6px;color:#075e52}
@media(max-width:600px){.vehicle-panel .panel-head{padding:14px;align-items:flex-start}.vehicle-panel .panel-head .button{font-size:.75rem;padding:9px 12px}.vehicle-tabs{margin:12px 0}}

/* v52 — scoped dashboard details, paged farms and compact mobile controls. */
.dashboard-status-grid > button { min-height: 90px; display: flex; flex-direction: column; justify-content: space-between; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--green-50); color: inherit; text-align: right; font: inherit; cursor: pointer; }
.dashboard-status-grid > button:hover, .dashboard-status-grid > button[aria-expanded="true"] { border-color: var(--green-700); background: #e5f5ef; }
.dashboard-status-grid > button strong { color: var(--green-800); font-size: 1.65rem; line-height: 1; }
.dashboard-status-grid > button span { color: var(--muted); font-size: .72rem; }
.dashboard-status-detail { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.dashboard-status-detail[hidden] { display: none; }
.dashboard-status-detail h3 { margin: 0 0 10px; font-size: .95rem; }
.dashboard-journey-list { display: grid; gap: 7px; max-height: 370px; overflow-y: auto; }
.dashboard-journey-list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--canvas); color: var(--ink); text-decoration: none; }
.dashboard-journey-list a:hover { background: var(--green-50); }
.dashboard-journey-list a > span { display: grid; gap: 4px; min-width: 0; }
.dashboard-journey-list small { color: var(--muted); }
.dashboard-journey-list em { flex: none; color: var(--green-800); font-size: .76rem; font-style: normal; }
.farm-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.farm-pagination > a:not(.button) { display: grid; min-width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--green-800); text-decoration: none; }
.farm-pagination > a[aria-current="page"] { background: var(--green-700); color: white; }
.map-region-row { display: contents; }
@media (max-width: 800px) {
  .map-sidebar { top: 0; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .sidebar-head::before { display: none; }
  .map-filters { display: flex; flex-direction: column; gap: 10px; }
  .map-region-row { display: flex; align-items: center; gap: 8px; order: 0; }
  .map-region-row .select-label { flex: 1; min-width: 0; margin-top: 0; }
  .map-search-toggle { flex: none; width: 50px; height: 50px; place-items: center; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--green-800); cursor: pointer; }
  .map-search-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  #farmSearchBox { order: 1; }
  #farmSearchBox:not(.is-open) { display: none; }
  #bastakSubregionWrap { order: 2; margin-top: 0; }
  .mobile-batch-entry { position: relative; display: block; }
  .mobile-batch-entry.has-delete .mobile-batch-card { padding-left: 61px; }
  .mobile-batch-entry > form { position: absolute; z-index: 2; top: 50%; left: 12px; padding: 0; transform: translateY(-50%); }
  .mobile-batch-trash { display: grid; width: 39px; height: 39px; place-items: center; border: 1px solid #f4d2ce; border-radius: 11px; background: #fff4f2; }
  .mobile-batch-trash svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .dashboard-journey-list a { align-items: flex-start; flex-direction: column; }
}
.load-line-header, .load-line-row { min-width: 1160px; grid-template-columns: 44px minmax(250px, 1.55fr) minmax(140px, .9fr) 150px 68px 80px 78px 165px 42px; }
.send-row-sms { width: 100%; margin-top: 5px; padding: 5px 7px; border: 1px solid #a6d5c5; border-radius: 8px; background: #eaf8f2; color: var(--green-800); font: inherit; font-size: .68rem; font-weight: 800; cursor: pointer; }
.send-row-sms:hover { background: #d8f0e5; }
.sms-row-result { margin-top: 4px; color: var(--green-800) !important; line-height: 1.6; }
@media (max-width: 800px) {
  .load-line-row { min-width: 0; grid-template-columns: 52px repeat(3, minmax(0,1fr)); }
  .send-row-sms { min-height: 35px; }
}

/* v54 — keep delivery controls to one compact cell; details live in a dialog. */
.load-line-row .delivery-summary {
  display: grid; grid-template-columns: 19px minmax(0, 1fr) 10px; align-items: center;
  gap: 6px; width: 100%; min-width: 0; height: 42px; min-height: 0;
  margin: 0; padding: 5px 7px; overflow: hidden;
  border: 1px solid #d6e7e1; border-radius: 9px;
  background: #f6faf8; color: var(--ink); text-align: right;
  font: inherit; cursor: pointer;
}
.load-line-row .delivery-summary:hover,
.load-line-row .delivery-summary:focus-visible { border-color: var(--green-700); background: #edf7f2; }
.delivery-summary-icon { color: var(--green-700); font-size: 1.08rem !important; line-height: 1; }
.delivery-summary-text { display: grid; min-width: 0; gap: 1px; }
.delivery-summary-text strong,
.delivery-summary-text small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; }
.delivery-summary-text strong { font-size: .66rem; font-weight: 800; }
.delivery-summary-text small { font-size: .6rem; color: var(--muted); }
.delivery-summary-arrow { color: var(--muted); font-size: 1.1rem !important; }
.delivery-summary.is-delivered .delivery-summary-icon,
.delivery-summary.is-delivered small { color: var(--green-700); }
.delivery-summary.is-error .delivery-summary-icon,
.delivery-summary.is-failed .delivery-summary-icon,
.delivery-summary.is-error small,
.delivery-summary.is-failed small { color: #a6372b; }
.delivery-summary.is-pending small { color: #886209; }
.load-sms-dialog-card { width: min(430px, calc(100vw - 28px)); display: grid; gap: 9px; }
.load-sms-dialog-card p { margin: 0; line-height: 1.75; }
.load-sms-dialog-recipient { font-weight: 800; }
.load-sms-dialog-status { color: var(--green-800); }
.load-sms-dialog-meta { color: var(--muted); font-size: .8rem; }
.load-sms-dialog-error { color: #a6372b; font-size: .8rem; }
.load-sms-dialog-card .form-actions { margin-top: 9px; }
@media (max-width: 800px) {
  .load-line-row .delivery-summary { height: 42px; padding: 5px 9px; }
}

/* v55 — the mobile map drawer must cover Leaflet controls. */
@media (max-width: 800px) {
  .map-body.drawer-open .map-stage .leaflet-control-zoom { visibility: hidden; pointer-events: none; }
  .map-body.drawer-open .map-stage { pointer-events: none; }
  .map-body.drawer-open .map-sidebar { z-index: 1200; }
  .map-body.drawer-open .drawer-backdrop { z-index: 1190; }
}
@media (max-width: 600px) {
  .dashboard-stats .stat-card:last-child,
  .dashboard-status-grid > button:last-child { grid-column: 1 / -1; }
  .dashboard-stats .stat-card:last-child { min-height: 100px; }
  .dashboard-status-grid > button:last-child { min-height: 75px; }
}

/* v55 — SMS compose, preview and per-send delivery history. */
.page-sms-center { background: #f7fafb; }
.sms-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 16px; padding: 4px 0 14px; }
.sms-heading-title { display: flex; align-items: center; gap: 13px; }
.sms-heading-icon { display: grid; width: 44px; height: 44px; flex: none; place-items: center; border: 1px solid #a8dcd3; border-radius: 12px; background: #e5f4f1; color: #087F74; font-size: 1.55rem; }
.sms-page-heading h1 { margin: 0 0 4px; font-size: 1.6rem; }
.sms-page-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.sms-history-link { padding: 11px 15px; border: 1px solid #d5e0e8; border-radius: 11px; background: #fff; color: #405873; font-size: .83rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.sms-controlbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 13px 18px; border: 1px solid #dbe8e5; border-radius: 16px; background: #fff; }
.sms-controlbar > div:first-child { display: grid; gap: 5px; }
.sms-controlbar small { color: var(--muted); font-size: .72rem; }
.sms-state-badge { width: max-content; padding: 4px 9px; border-radius: 8px; font-size: .76rem; }
.sms-state-badge.is-on { background: #e4f6f0; color: #077562; }
.sms-state-badge.is-off { background: #fff2dd; color: #925a00; }
.sms-control-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sms-control-actions form { margin: 0; }
.page-sms-center button:disabled { opacity: .5; cursor: not-allowed; }
.sms-compose-tabs { display: flex; justify-content: flex-start; gap: 5px; margin: 0 0 10px; }
.sms-compose-tabs button { min-height: 48px; padding: 10px 22px; border: 1px solid #dce5e9; border-bottom: 3px solid transparent; border-radius: 11px 11px 0 0; background: #fff; color: #50617b; font: inherit; font-size: .85rem; font-weight: 800; cursor: pointer; }
.sms-compose-tabs button.is-active { border-bottom-color: #087F74; color: #087F74; }
.sms-compose-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .9fr); align-items: start; gap: 17px; }
.sms-compose-main { min-width: 0; }
.page-sms-center .sms-panel,
.page-sms-center .sms-preview-panel { border: 1px solid #e0e9ec; border-radius: 17px; background: #fff; box-shadow: 0 7px 25px rgba(31,64,70,.045); }
.page-sms-center .sms-compose-section { padding: 24px; }
.page-sms-center .sms-compose-section[hidden] { display: none !important; }
.sms-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sms-section-head h2 { margin: 0; color: #13243e; font-size: 1.08rem; }
.sms-selected-badge { padding: 7px 10px; border: 1px solid #d7ede9; border-radius: 9px; background: #edf8f6; color: #087F74; font-size: .72rem; font-weight: 800; }
.page-sms-center .sms-compose-section .form-stack { display: grid; gap: 14px; margin-top: 16px; }
.sms-search-field { margin: 0; }
.page-sms-center .sms-compose-section input:not([type="checkbox"]),
.page-sms-center .sms-compose-section select,
.page-sms-center .sms-compose-section textarea { border-color: #d5e0e7; border-radius: 10px; background: #fff; }
.page-sms-center .sms-compose-section textarea { min-height: 116px; }
.page-sms-center .sms-recipient-list { max-height: 288px; border-color: #e0e9ec; border-radius: 12px; }
.sms-filter-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sms-filter-chips button { padding: 7px 12px; border: 1px solid #dbe6e8; border-radius: 9px; background: #f8fbfc; color: #5b6f81; font: inherit; font-size: .74rem; font-weight: 800; cursor: pointer; }
.sms-filter-chips button.is-active { border-color: #9ad7cb; background: #e5f6f2; color: #087F74; }
.page-sms-center .sms-recipient { display: grid !important; grid-template-columns: 21px minmax(0,1fr) auto; gap: 12px; min-height: 58px; }
.page-sms-center .sms-recipient[hidden] { display: none !important; }
.page-sms-center .sms-recipient span { min-width: 0; }
.sms-recipient-phone { direction: ltr; color: #627594; white-space: nowrap; }
.page-sms-center .sms-select-actions button { background: #f6fafb; color: #52647a; }
.page-sms-center .sms-select-actions button:hover { border-color: #76bdb0; color: #087F74; }
.sms-message-heading { margin-top: 12px; padding-top: 19px; border-top: 1px solid #edf1f3; }
.page-sms-center .sms-submit { width: 100%; min-height: 48px; background: #087F74; }
.sms-soft-note { margin: 0; padding: 12px; border-radius: 10px; background: #eaf7f5; color: #067162; font-size: .76rem; }
.sms-preview-panel { position: sticky; top: 16px; padding: 25px; }
.sms-preview-panel .sms-section-head { padding-bottom: 12px; }
.sms-preview-for { margin: 16px 0 11px; color: #71819a; font-size: .75rem; }
.sms-preview-bubble { min-height: 125px; padding: 19px; border-radius: 18px 18px 18px 5px; background: #e7f7f4; color: #1b3c40; line-height: 1.9; white-space: pre-line; overflow-wrap: anywhere; }
.sms-preview-facts { margin: 23px 0 0; }
.sms-preview-facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid #e2e9ed; font-size: .78rem; }
.sms-preview-facts dt { color: #61718a; }
.sms-preview-facts dd { margin: 0; color: #182f48; font-weight: 800; text-align: left; }
.sms-preview-hint { margin: 11px 0 0; padding: 12px; border-radius: 10px; background: #f3f7fa; color: #71819a; font-size: .72rem; line-height: 1.9; }
.page-sms-center .sms-history { margin-top: 22px; padding: 22px; }
.sms-history .sms-section-head { margin-bottom: 14px; }
.sms-history .sms-section-head p { margin: 5px 0 0; }
.sms-batch-list { display: grid; gap: 9px; }
.sms-batch-details { border: 1px solid #dee8eb; border-radius: 12px; overflow: hidden; background: #fff; }
.sms-batch-details > summary { display: grid; grid-template-columns: minmax(0,1fr) auto 20px; align-items: center; gap: 12px; min-height: 70px; padding: 12px 16px; cursor: pointer; list-style: none; }
.sms-batch-details > summary::-webkit-details-marker { display: none; }
.sms-batch-details[open] > summary { border-bottom: 1px solid #e4edef; background: #f6fbfa; }
.sms-history-title { display: grid; min-width: 0; gap: 4px; }
.sms-history-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #152d43; font-size: .9rem; }
.sms-history-title small { color: #71819a; font-size: .72rem; }
.sms-batch-chevron { font-size: 1.25rem; color: #087F74; transition: transform .15s; }
.sms-batch-details[open] .sms-batch-chevron { transform: rotate(180deg); }
.sms-batch-content { padding: 15px; }
.sms-delivery-list { display: grid; gap: 9px; }
.sms-delivery-row { padding: 12px 14px; border: 1px solid #e3ebed; border-radius: 10px; background: #fff; }
.sms-delivery-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sms-delivery-head > span:first-child { display: grid; gap: 3px; }
.sms-delivery-head small { color: #6d8098; font-size: .72rem; }
.sms-delivery-status { flex: none; padding: 5px 8px; border-radius: 7px; background: #eff5f6; color: #55687c; font-size: .7rem; font-weight: 800; }
.sms-delivery-status.is-sent { background: #e6f5ef; color: #087F74; }
.sms-delivery-status.is-failed, .sms-delivery-status.is-unknown { background: #fff0ee; color: #a83d31; }
.sms-delivery-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; color: #71819a; font-size: .7rem; }
.sms-delivery-meta b { font-weight: 600; }
.sms-pending-text { margin: 10px 0 0; padding: 10px; border-radius: 8px; background: #f5faf9; white-space: pre-line; font-size: .75rem; }
.sms-delivery-error { margin: 10px 0 0; color: #a83d31; font-size: .75rem; }
.sms-check-form { margin: 11px 0 0; }
.sms-check-form button { font-size: .74rem; }
.sms-batch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.sms-batch-actions form { margin: 0; }
@media (max-width: 950px) {
  .sms-compose-layout { grid-template-columns: minmax(0,1fr); }
  .sms-preview-panel { position: static; }
}
@media (max-width: 600px) {
  .sms-page-heading { align-items: flex-start; flex-direction: column; }
  .sms-history-link { align-self: flex-end; }
  .sms-controlbar { align-items: stretch; flex-direction: column; }
  .sms-control-actions form { flex: 1; }
  .sms-control-actions button { width: 100%; }
  .sms-compose-tabs button { flex: 1; padding: 9px; font-size: .76rem; }
  .page-sms-center .sms-compose-section, .sms-preview-panel, .page-sms-center .sms-history { padding: 16px; }
  .sms-batch-details > summary { grid-template-columns: minmax(0,1fr) 20px; }
  .sms-batch-status { grid-column: 1; grid-row: 2; }
  .sms-batch-chevron { grid-column: 2; grid-row: 1 / span 2; }
  .sms-recipient-phone { font-size: .7rem; }
}
