:root{
  --bg:#f3f6f1;
  --card:#ffffff;
  --text:#1f2a22;
  --muted:#728078;
  --accent:#2f5d3a;
  --accent-dark:#24492e;
  --accent2:#dfeadd;
  --line:#e6ebe4;
  --warn:#fff2d6;
  --danger:#8d3d2f;
}

*{box-sizing:border-box}
[hidden]{display:none!important}

html{scroll-behavior:smooth}

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

button,input,textarea,select{font:inherit}
button{cursor:pointer}

button:disabled{
  cursor:not-allowed;
  opacity:.55;
}

.app-shell{
  max-width:1200px;
  margin:0 auto;
  padding:20px 16px 96px;
  min-height:100vh;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:14px;
}

.eyebrow,.small{
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

h1{margin:3px 0 0;font-size:30px}
h2{margin:4px 0 0;font-size:20px}

.status-dot{
  width:12px;
  height:12px;
  border-radius:50%;
  background:#56a96b;
  box-shadow:0 0 0 5px #dcefe1;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:0 8px 24px rgba(38,55,42,.05);
}

.hero{
  padding:20px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:linear-gradient(135deg,#ffffff,#eef5eb);
}

.weather-line{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin:7px 0;
}

.temp{font-size:34px;font-weight:800}
.hint{font-size:13px;color:var(--accent);font-weight:700}
.weather-icon{font-size:52px}

.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin:14px 0;
}

.module{
  min-height:132px;
  padding:16px;
  border:1px solid var(--line);
  text-align:left;
  display:flex;
  flex-direction:column;
  gap:8px;
  color:var(--text);
}

.module-map{
  grid-column:1 / -1;
  min-height:108px;
  background:linear-gradient(135deg,#ffffff,#eaf2e8);
}

.module .icon{font-size:28px}
.module strong{font-size:16px}
.module span:last-child{font-size:12px;color:var(--muted)}

.notifications-card{
  margin:14px 0;
  padding:14px;
}

.notifications-toggle{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border:0;
  background:transparent;
  color:var(--text);
  padding:0;
  font-weight:700;
  text-align:left;
}

.notifications-badge{
  min-width:24px;
  padding:3px 7px;
  border-radius:999px;
  background:var(--danger);
  color:#fff;
  font-size:12px;
  text-align:center;
}

.notifications-list{
  display:grid;
  gap:9px;
  margin-top:12px;
}

.notifications-list[hidden]{display:none}

.notification-item{
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}

.notification-item.is-new{
  border-color:#d4a24c;
  background:#fffaf0;
}

.notification-meta,
.notifications-empty{
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
}

.notification-message{
  margin-top:7px;
  white-space:pre-line;
  font-size:13px;
  line-height:1.45;
}

.notification-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin-top:9px;
}

.notification-parcel-target{
  outline:3px solid rgba(212,162,76,.45);
  outline-offset:2px;
}

.panel-card{
  padding:16px;
  margin:14px 0;
}

#addFieldButton,
#addFieldForm{
  margin-top:14px;
}

/* =====================================================
   ГРУППЫ И КАРТОЧКИ УЧАСТКОВ
   ===================================================== */

.field-group-header{
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#f7faf6;
  flex-wrap:wrap;
}

.field-group-title-block{
  flex:1 1 190px;
}

.field-group-actions{
  flex:0 1 auto;
}

.field-group-parcels{
  display:grid;
  gap:10px;
}

.field-group-parcels[hidden]{
  display:none;
}

.parcel-card-row{
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
}

.parcel-card-head{
  display:block;
}

.parcel-card-info{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  flex-wrap:wrap;
}

.parcel-card-identifier{
  flex:1 1 230px;
  min-width:0;
  font-size:13px;
  font-weight:700;
  line-height:1.35;
  overflow-wrap:break-word;
  word-break:normal;
  cursor:text;
  user-select:text;
}

.parcel-card-area{
  flex:0 0 auto;
  padding:4px 8px;
  border-radius:999px;
  background:var(--accent2);
  color:var(--accent-dark);
  font-size:12px;
  font-weight:700;
  line-height:1.25;
  white-space:nowrap;
}

.parcel-season-card{
  margin-top:10px;
  padding:10px;
  border:1px solid #dce7dc;
  border-radius:10px;
  background:#f7faf6;
  font-size:12px;
  line-height:1.45;
}

.parcel-season-card > strong{
  display:block;
  font-size:13px;
}

.parcel-season-values{
  display:grid;
  gap:2px;
  margin-top:5px;
}

.parcel-season-values span{
  color:var(--muted);
  font-weight:600;
}

.parcel-season-empty{
  margin-top:4px;
  color:var(--muted);
}

.parcel-season-edit-button{
  margin-top:7px;
}

.parcel-season-editor{
  margin-top:10px;
  padding-top:4px;
  border-top:1px solid var(--line);
}

.parcel-season-editor-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}

.parcel-season-editor-status{
  margin-top:7px;
  color:var(--muted);
}

.parcel-season-editor-status.is-error{
  color:var(--danger);
}

.field-group-parcels .parcel-row-actions{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;
  width:100%;
  max-width:none;
  margin-top:10px;
}

.field-group-parcels .parcel-row-actions button{
  width:100%;
  min-height:38px;
  padding:7px 6px !important;
  font-size:12px !important;
  line-height:1.2;
}

.alert{
  padding:16px;
  margin:14px 0;
  background:var(--warn);
}

.alert-title{
  font-weight:800;
  margin-bottom:6px;
}

.ai-card{padding:16px}
.ai-head{display:flex;justify-content:space-between;align-items:center}

.chip{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--accent2);
  color:var(--accent);
  font-weight:800;
}

.chat{
  display:flex;
  flex-direction:column;
  gap:10px;
  max-height:300px;
  overflow:auto;
  margin:14px 0;
}

.msg{
  max-width:86%;
  padding:11px 13px;
  border-radius:16px;
  line-height:1.35;
  font-size:14px;
}

.msg.ai{background:#eef3ec;align-self:flex-start}
.msg.user{background:var(--accent);color:#fff;align-self:flex-end}

.chat-form{
  display:grid;
  grid-template-columns:1fr 46px;
  gap:8px;
}

.chat-form input{
  border:1px solid var(--line);
  border-radius:14px;
  padding:13px 14px;
  outline:none;
}

.chat-form button,
.map-search-form button,
.map-actions button:not(.secondary-button),
#startDrawBoundaryButton,
#saveBoundaryButton{
  border:0;
  background:var(--accent);
  color:#fff;
}

.chat-form button:hover,
.map-search-form button:hover,
.map-actions button:not(.secondary-button):hover{
  background:var(--accent-dark);
}

/* =====================================================
   КАРТА
   ===================================================== */

.map-card{
  padding:16px;
  margin:14px 0;
}

.map-panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.map-help{
  margin:12px 0;
  color:var(--muted);
  font-size:13px;
  line-height:1.45;
}

.map-search-form{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
}

.map-search-form input{
  min-width:0;
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px 13px;
  outline:none;
  background:#fff;
}

.map-search-form input:focus{
  border-color:#8eb39a;
  box-shadow:0 0 0 3px rgba(47,93,58,.09);
}

.map-search-form button,
.map-actions button,
.secondary-button,
.ghost-button{
  border-radius:12px;
  padding:11px 13px;
  font-weight:700;
}

.secondary-button{
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
}

.ghost-button{
  border:0;
  background:#eef3ec;
  color:var(--accent);
}

.map-status{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  background:#f4f7f3;
  color:var(--muted);
  font-size:13px;
  line-height:1.4;
}

.map-status.is-error{
  background:#fff0ec;
  color:var(--danger);
}

.map-status.is-success{
  background:#edf7ef;
  color:var(--accent-dark);
}

.map-parcel-card{
  margin-top:10px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
}

.map-parcel-title{
  font-size:15px;
  font-weight:800;
  word-break:break-word;
}

.map-parcel-meta{
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
  line-height:1.4;
}

.map-toolbar-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:12px 0 8px;
  flex-wrap:wrap;
}

.map-toolbar-row button{
  padding:9px 11px;
  border-radius:10px;
}

.map-toolbar-hint{
  flex:1;
  min-width:180px;
  font-size:11px;
  line-height:1.35;
  color:var(--muted);
}

.farm-map{
  width:100%;
  height:430px;
  border-radius:16px;
  overflow:hidden;
  border:1px solid var(--line);
  background:#e9eee7;
  z-index:0;
}

.farm-map .leaflet-control-layers{
  border-radius:10px;
}

.farm-map .leaflet-control-attribution{
  font-size:9px;
}

.map-area-info{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  background:#f4f7f3;
  font-size:13px;
  line-height:1.4;
}

.map-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:10px;
}

.map-actions button{
  min-height:44px;
  border-radius:12px;
  padding:10px 12px;
}

.map-note{
  margin-top:12px;
  padding-top:12px;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:11px;
  line-height:1.45;
}

.parcel-satellite-panel{
  margin-top:10px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#f7faf6;
}

.satellite-source{
  margin-top:8px;
  color:var(--ink);
  font-size:13px;
  font-weight:700;
}

.satellite-provider{
  margin-top:2px;
  color:var(--muted);
  font-size:11px;
}

.satellite-metrics{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
  margin-top:9px;
}

.satellite-metric{
  padding:8px;
  border-radius:9px;
  background:#fff;
}

.satellite-metric span,
.satellite-metric strong{
  display:block;
}

.satellite-metric span{
  color:var(--muted);
  font-size:10px;
}

.satellite-metric strong{
  margin-top:2px;
  font-size:13px;
}

.satellite-status{
  margin-top:9px;
  color:var(--muted);
  font-size:11px;
  line-height:1.4;
}

.satellite-status.is-error{
  color:var(--danger);
}

.satellite-refresh-button{
  margin-top:9px;
}

.satellite-history-title{
  margin:16px 0 7px;
  font-size:13px;
}

.satellite-history-content{
  overflow-x:auto;
}

.satellite-history-table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
  font-size:11px;
}

.satellite-history-table th,
.satellite-history-table td{
  padding:7px 6px;
  border-bottom:1px solid var(--line);
  text-align:left;
  white-space:nowrap;
}

.satellite-history-table th{
  color:var(--muted);
  font-weight:600;
}

.satellite-history-button{
  margin-top:9px;
}

.parcel-history-button{
  width:100%;
  min-height:38px;
  margin-top:8px;
  border:1px solid #cbd9cc;
  border-radius:10px;
  background:#f4f8f3;
  color:var(--accent-dark);
  font-size:12px;
  font-weight:700;
}

.parcel-field-timeline-panel{
  margin-top:10px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#f7faf6;
}

.field-status-title{
  display:block;
  font-size:14px;
}

.field-status-summary{
  margin-top:9px;
  color:var(--muted);
  font-size:11px;
  line-height:1.4;
}

.field-status-summary.is-error{
  color:var(--danger);
}

.field-status-metrics{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
}

.field-status-metric{
  min-width:0;
  padding:8px 9px;
  border:1px solid #dfe9df;
  border-radius:9px;
  background:#fff;
}

.field-status-label{
  display:block;
  color:var(--muted);
  font-size:10px;
}

.field-status-value{
  display:block;
  margin-top:2px;
  color:var(--text);
  font-size:12px;
}

.field-status-recent{
  display:grid;
  gap:4px;
  margin-top:8px;
  padding:0 2px;
}

.field-status-empty{
  margin:0;
}

.satellite-alert-card{
  margin-top:10px;
  padding:11px;
  border:1px solid #e4c978;
  border-left:4px solid #c98a16;
  border-radius:10px;
  background:#fffaf0;
  color:var(--text);
  font-size:11px;
  line-height:1.45;
}

.satellite-alert-title{
  display:block;
  color:#82570b;
  font-size:13px;
}

.satellite-alert-card p{
  margin:6px 0 0;
}

.satellite-alert-evidence,
.satellite-alert-weather{
  color:var(--muted);
}

.satellite-alert-summary{
  padding-top:6px;
  border-top:1px solid rgba(130,87,11,.15);
}

.satellite-alert-caution{
  font-weight:700;
}

.satellite-alert-next{
  color:var(--accent-dark);
  font-weight:700;
}

.satellite-alert-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:7px;
  margin-top:10px;
}

.satellite-alert-reviewed{
  padding:5px 8px;
  border-radius:999px;
  background:#f0eadb;
  color:#6c5a2b;
  font-size:10px;
  font-weight:700;
}

.field-timeline-controls{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin-top:10px;
}

.field-timeline-details{
  margin-top:10px;
  border-top:1px solid var(--line);
}

.field-timeline-details summary{
  padding-top:10px;
  color:var(--accent-dark);
  font-size:11px;
  font-weight:700;
  cursor:pointer;
  user-select:none;
}

.field-timeline-content{
  display:grid;
  gap:8px;
  margin-top:12px;
}

.field-timeline-event{
  padding:9px 10px;
  border-left:3px solid #8fab91;
  border-radius:9px;
  background:#fff;
}

.field-timeline-event.is-satellite{border-left-color:#5d82bc}
.field-timeline-event.is-work_planned,
.field-timeline-event.is-work_started,
.field-timeline-event.is-work_completed,
.field-timeline-event.is-work_cancelled,
.field-timeline-event.is-work_result{border-left-color:#a87832}
.field-timeline-event.is-observation{border-left-color:#4e9462}
.field-timeline-event.is-weather_period{border-left-color:#6d90a3}

.field-timeline-event-head{
  display:flex;
  justify-content:space-between;
  gap:10px;
  color:var(--muted);
  font-size:10px;
}

.field-timeline-event-title{
  margin-top:3px;
  font-size:12px;
  font-weight:700;
}

.field-timeline-event-summary{
  margin-top:3px;
  color:var(--muted);
  font-size:11px;
  line-height:1.4;
}

.field-timeline-status{
  margin-top:10px;
  color:var(--muted);
  font-size:11px;
  line-height:1.4;
}

.field-timeline-status.is-error,
.parcel-context-analysis.is-error{
  color:var(--danger);
}

.parcel-context-analysis:not(:empty){
  margin-top:12px;
  padding:10px;
  border:1px solid #dbe8dc;
  border-radius:10px;
  background:#fff;
  font-size:11px;
  line-height:1.45;
}

.parcel-context-analysis p{
  margin:6px 0 9px;
}

.parcel-context-analysis ul{
  margin:4px 0 9px;
  padding-left:18px;
}

.parcel-analysis-head{
  margin-top:5px;
  color:var(--accent-dark);
  font-weight:800;
}

.parcel-analysis-title{
  display:block;
  font-size:13px;
}

.parcel-analysis-evidence{
  padding:8px;
  border-radius:8px;
  background:#f2f7f1;
  color:var(--muted);
}

.parcel-analysis-next{
  padding-top:8px;
  border-top:1px solid var(--line);
  font-weight:700;
}

.parcel-analysis-actions{
  display:grid;
  gap:8px;
  margin-top:10px;
}

.parcel-analysis-action-group{
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
}

.parcel-analysis-action-group > .observation-work-planner{
  width:100%;
}

.parcel-analysis-action-status{
  color:var(--accent-dark);
  font-weight:800;
}

.parcel-analysis-actions .observation-work-form{
  display:grid;
  gap:8px;
  padding:10px;
  border:1px solid #dbe8dc;
  border-radius:9px;
  background:#f8fbf7;
}

.parcel-analysis-actions .observation-work-form[hidden],
.parcel-analysis-actions .observation-work-form [hidden]{
  display:none;
}

.parcel-analysis-actions .observation-work-form label{
  display:grid;
  gap:4px;
}

.parcel-analysis-actions .observation-work-form input,
.parcel-analysis-actions .observation-work-form select,
.parcel-analysis-actions .observation-work-form textarea{
  width:100%;
  box-sizing:border-box;
  padding:7px;
  border:1px solid #bacbbb;
  border-radius:7px;
}

.parcel-analysis-actions .observation-actions{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
}

/* =====================================================
   НИЖНЯЯ НАВИГАЦИЯ
   ===================================================== */

.bottom-nav{
  position:fixed;
  bottom:0;
  left:50%;
  transform:translateX(-50%);
  width:min(520px,100%);
  display:grid;
  grid-template-columns:repeat(5,1fr);
  padding:10px 8px calc(10px + env(safe-area-inset-bottom));
  background:rgba(255,255,255,.96);
  border-top:1px solid var(--line);
  backdrop-filter:blur(12px);
  z-index:1000;
}

.bottom-nav button{
  border:0;
  background:transparent;
  color:var(--muted);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:3px;
  font-size:18px;
  padding:8px 2px;
  min-height:44px;
}

.bottom-nav button span{font-size:10px}
.bottom-nav button.active{color:var(--accent);font-weight:800}
.bottom-nav .desktop-only { display: none; }

@media (max-width:420px){
  .app-shell{
    padding-left:12px;
    padding-right:12px;
  }

  .farm-map{
    height:390px;
  }

  .map-actions{
    grid-template-columns:1fr;
  }

  .satellite-metrics{
    grid-template-columns:1fr;
  }

  .map-search-form{
    grid-template-columns:1fr;
  }

  .field-group-actions{
    width:100%;
    justify-content:flex-start !important;
  }

  .field-group-parcels .parcel-row-actions{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
/* Economics MVP: fluid cards and contained table scrolling, no page-wide overflow. */
.economics-panel { min-width: 0; scroll-margin-top: 20px; padding: 20px; }
.economics-panel[hidden], .economics-panel [hidden] { display: none !important; }
.economics-panel label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.economics-panel input, .economics-panel select, .economics-panel textarea {
  box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0;
  border: 1px solid #cddbcc; border-radius: 8px; padding: 10px; font: inherit;
}
.economics-panel textarea { margin: 8px 0; }
.economics-panel button { white-space: normal; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; }
.economics-panel button.secondary-button { background: #fff; color: var(--accent); border-color: #cddbcc; }
.economics-panel details { margin: 16px 0; }
.economics-panel summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.econ-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 12px; align-items: end; margin: 12px 0; }
.econ-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin: 16px 0; }
.econ-kpi, .econ-scenario { background: #f3f8f1; border: 1px solid #d7e4d3; border-radius: 12px; padding: 14px; min-width: 0; overflow-wrap: anywhere; }
.econ-kpi span { display: block; font-size: 13px; }
.econ-kpi strong { display: block; margin-top: 8px; font-size: 20px; }
.econ-scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.econ-scenario { min-width: 0; overflow-wrap: anywhere; }
.econ-scenario h4 { font-size: 14px; min-height: 42px; overflow-wrap: normal; }
.econ-scenario-result { border-left: 4px solid #64748b; padding: 10px; background: #f1f5f9; border-radius: 6px; }
.econ-scenario-result.profit { border-color: #15803d; background: #f0fdf4; color: #166534; }
.econ-scenario-result.loss { border-color: #b91c1c; background: #fef2f2; color: #991b1b; }
.econ-scenario-badge { font-size: 11px; letter-spacing: .03em; }
.econ-scenario-profit { font-size: 20px; font-weight: 700; }
@media (max-width: 700px) { .econ-scenario-grid { grid-template-columns: 1fr; } }
.econ-scenario label { margin: 10px 0; }
.econ-table-scroll { max-width: 100%; overflow-x: auto; margin: 12px 0; }
.econ-table-scroll table { border-collapse: collapse; width: 100%; min-width: 620px; }
.econ-table-scroll th, .econ-table-scroll td { padding: 9px; text-align: left; border-bottom: 1px solid #dce5d7; overflow-wrap: anywhere; }
#econStatus { min-height: 1.5em; color: #254c2d; overflow-wrap: anywhere; }
.econ-section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.econ-section-heading h3 { margin: 0; }
.econ-cost-advanced, .econ-full-width { grid-column: 1 / -1; }
.econ-crop-parcel { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px; border-bottom: 1px solid #dce5d7; }
.econ-responsive-table [data-inline-cost] { min-width: 0; }
.econ-responsive-table tr.econ-cost-saved { outline: 2px solid #15803d; outline-offset: -2px; background: #f0fdf4; }
.econ-market-card { background: #f3f8f1; border: 1px solid #d7e4d3; border-radius: 12px; padding: 16px; margin: 12px 0; overflow-wrap: break-word; }
.econ-market-card h4 { margin: 0 0 10px; }
.econ-market-card strong { font-size: 24px; }
.econ-source { font-weight: 600; color: #355939; }
.econ-responsive-table caption { text-align: left; font-size: 13px; color: #52624f; padding: 8px 0; }
.econ-responsive-table small { display: block; margin-top: 4px; font-size: 12px; }
.econ-responsive-table td button { margin: 3px 6px 3px 0; }
/* Cards follow the panel's available width, not just the screen width. */
.economics-panel { container-type: inline-size; }
@container (max-width: 700px) {
  .econ-table-scroll { overflow: visible; }
  .econ-table-scroll .econ-responsive-table { display: block; min-width: 0; width: 100%; }
  .econ-responsive-table thead { display: none; }
  .econ-responsive-table caption { display: block; width: 100%; }
  .econ-responsive-table tbody { display: grid; gap: 12px; }
  .econ-responsive-table tr { display: block; border: 1px solid #d7e4d3; border-radius: 12px; padding: 12px; background: #fbfdf9; }
  .econ-table-scroll .econ-responsive-table td { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 10px; padding: 8px 0; overflow-wrap: break-word; }
  .econ-responsive-table td::before { content: attr(data-label); font-weight: 600; color: #52624f; }
  .econ-responsive-table td > span { min-width: 0; }
  .econ-responsive-table td:last-child { border-bottom: 0; }
  .econ-responsive-table td[colspan] { display: block; }
  .econ-responsive-table td[colspan]::before { content: none; }
}
@container (max-width: 360px) {
  .econ-table-scroll .econ-responsive-table td { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

/* Pilot presentation: existing navigation/sections, no additional UI framework. */
.app-shell { width: 100%; }
.app-shell > section { min-width: 0; }
.card { overflow-wrap: break-word; }
button, input, select { min-height: 44px; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #88ad8e; outline-offset: 3px;
}
.econ-kpi strong, .econ-market-card strong, .econ-coverage-grid strong, .econ-responsive-table {
  font-variant-numeric: tabular-nums;
}
.econ-kpi[data-tone="profit"] { background: #eef6ed; border-color: #b6cfb7; }
.econ-kpi[data-tone="profit"] strong { color: #2f5d3a; }
.econ-kpi[data-tone="loss"] { background: #faf1ec; border-color: #dcbeb0; }
.econ-kpi[data-tone="loss"] strong { color: #8d3d2f; }
.econ-completeness { border: 1px solid #ddd2b8; border-left: 4px solid #ad8c49; border-radius: 12px; padding: 18px; margin: 20px 0; background: #fffcf4; }
.econ-completeness[data-status="complete"] { border-color: #b6cfb7; background: #f3f8f1; }
.econ-completeness h3 { margin: 0 0 16px; }
.econ-completeness p { font-size: 14px; line-height: 1.6; margin-bottom: 0; }
.econ-coverage-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.econ-coverage-grid span, .econ-coverage-grid small { display: block; font-size: 13px; color: #536456; }
.econ-coverage-grid strong { display: block; margin: 8px 0; font-size: 22px; }
.econ-parcel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.econ-crop-parcel { display: flex; flex-direction: column; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.econ-crop-parcel dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; font-size: 14px; }
.econ-crop-parcel dt { color: #536456; }
.econ-crop-parcel dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.econ-crop-parcel .hint { font-weight: 400; margin: 0; }
.econ-status-badge { display: block; color: #536456; font-size: 12px; margin-top: 8px; }
.economics-panel h3 { margin-top: 28px; }
.economics-panel .econ-completeness h3 { margin-top: 0; }
.economics-panel .hint { font-weight: 400; line-height: 1.5; }
.econ-responsive-table th { background: #f5f8f3; font-size: 13px; color: #536456; }
.econ-responsive-table td { line-height: 1.5; }
.econ-form-grid { gap: 16px; }
@media (min-width: 1000px) {
  .app-shell { padding: 108px 28px 40px; }
  h1 { font-size: 34px; }
  h2 { font-size: 26px; }
  .topbar { margin-bottom: 24px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
  .module-map { grid-column: auto; min-height: 132px; }
  .bottom-nav { top: 0; bottom: auto; width: min(1200px, 100%); grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 12px 28px; border-top: 0; border-bottom: 1px solid var(--line); border-radius: 0 0 16px 16px; }
  .bottom-nav .desktop-only { display: flex; }
  .bottom-nav button { flex-direction: row; justify-content: center; gap: 10px; font-size: 20px; }
  .bottom-nav button span { font-size: 14px; }
  .econ-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .economics-panel { padding: 28px; }
  .app-shell > section { scroll-margin-top: 92px; }
}
@media (min-width: 601px) and (max-width: 999px) {
  .app-shell { padding: 24px 24px 104px; }
  .bottom-nav { width: min(768px, 100%); }
  .econ-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .econ-kpis, .econ-parcel-grid, .econ-coverage-grid { grid-template-columns: minmax(0, 1fr); }
  .econ-kpi { padding: 16px; }
  .econ-kpi strong { font-size: 22px; }
  .weather-line { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }


.observation-product-options { display:grid; gap:10px; margin:14px 0; min-width:0; }
.observation-product-options h4 { margin:0; font-size:15px; }
.observation-product-card { padding:12px; border:1px solid #dbe8dc; border-radius:10px; background:#f8fbf7; min-width:0; overflow-wrap:anywhere; }
.observation-product-card p { margin:7px 0; line-height:1.45; font-size:13px; }
.observation-product-card button { margin-top:5px; }
.observation-chain { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; padding:0; margin:10px 0; list-style:none; }
.observation-chain li { min-width:0; padding:8px; border-radius:8px; background:#f1f6f0; font-size:12px; overflow-wrap:anywhere; }
.observation-chain li:not(:last-child) strong::after { content:" →"; }
.observation-chain strong,.observation-chain span { display:block; }
.observation-chain span { margin-top:4px; color:#526456; }
.observation-work-form { min-width:0; overflow-wrap:anywhere; scroll-margin-top:var(--topbar-offset,270px); }
.observation-work-form [hidden] { display:none !important; }
.observation-work-form [data-weather-fields] summary { cursor:pointer; font-weight:600; margin-bottom:8px; }
.observation-work-confirmations { padding:12px; border:1px solid #d7bd7e; border-radius:9px; background:#fffaf0; }
.observation-work-form .observation-work-confirmations label { display:flex !important; align-items:flex-start; gap:9px; margin-top:12px; line-height:1.45; }
.observation-work-form .observation-work-confirmations input[type=checkbox] { width:20px !important; height:20px; flex:0 0 20px; margin:0; }
.observation-work-form [data-chemical-instruction] { white-space:pre-wrap; }
.observation-work-form button:disabled { opacity:.5; cursor:not-allowed; }
@media (max-width:600px) { .observation-chain { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.observation-decision-planner { min-width:0; margin-top:12px; }
.observation-plan-message { max-width:100%; white-space:normal; }
.observation-work-form [data-work-details] { padding:10px; border:1px solid #dce6da; border-radius:8px; }
.observation-work-form [data-work-details] > summary { cursor:pointer; font-weight:600; }
.observation-work-form [data-weather-summary] { margin:6px 0; font-weight:600; }
.observation-work-form input,.observation-work-form select,.observation-work-form textarea { min-width:0; max-width:100%; box-sizing:border-box; }
.observation-product-card > details { margin:6px 0; }

.parcel-boundary-note { color:#795b23; font-size:12px; line-height:1.4; margin:6px 0 0; }

.inline-action-confirmation,.inline-action-notice { box-sizing:border-box; flex-basis:100%; min-width:0; width:100%; padding:12px; border:1px solid #d7bd7e; border-radius:8px; background:#fffaf0; overflow-wrap:anywhere; }
.inline-action-confirmation p { white-space:pre-line; margin:0 0 10px; }
.inline-action-confirmation button { min-height:44px; margin:4px; }

/* Mobile shell: reuse the existing navigation and preserve every workspace. */
@media (max-width:999px) {
  body .app-shell { min-height:100dvh; padding: max(8px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left)); }
  body .app-shell .topbar { display:grid; grid-template-columns:minmax(0,1fr) 78px 48px; gap:6px; padding:6px 0; margin-bottom:12px; top:0; min-height:56px; }
  body .topbar .workspace-title { grid-column:1; grid-row:1; min-width:0; }
  body .topbar .eyebrow { display:none; }
  body .topbar h1 { font-size:18px; line-height:1.2; margin:0; overflow-wrap:anywhere; }
  body .topbar .workspace-actions { grid-column:3; grid-row:1; }
  body .topbar #headerNotifications { display:none; }
  body #mobileMenuToggle { display:flex; flex-direction:column; justify-content:center; gap:2px; width:48px; min-height:48px; padding:4px; }
  body #mobileMenuToggle span { font-size:13px; line-height:1; }
  body #mobileMenuToggle svg { width:20px; height:20px; }
  body #harvestSeasonToolbar { display:block; grid-column:2; grid-row:1; margin:0; min-width:0; }
  body #harvestSeasonToolbar small { display:none; }
  body #harvestSeasonPicker { margin:0; display:block; }
  body #harvestSeasonPicker .harvest-season-caption { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  body #harvestSeasonPicker select { width:78px; min-height:44px; font-size:16px; padding:8px 4px; }
  html:not(.mobile-menu-open) body #workspaceNavigation { display:grid; grid-template-columns:1.05fr .75fr 1.6fr .95fr .65fr; left:0; bottom:0; top:auto; transform:none; width:100%; padding:6px max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left)); gap:0; }
  html:not(.mobile-menu-open) body #workspaceNavigation [data-nav] { display:flex; flex-direction:column; justify-content:center; align-items:center; min-height:60px; min-width:0; padding:4px 2px; gap:3px; border-radius:8px; }
  html:not(.mobile-menu-open) body #workspaceNavigation .desktop-only { display:none; }
  html:not(.mobile-menu-open) body #workspaceNavigation [data-nav] span { font-size:13px; line-height:1.15; white-space:normal; }
  html:not(.mobile-menu-open) body #workspaceNavigation [data-nav].active { background:#edf5ef; color:#155337; }
  html.mobile-menu-open body #workspaceNavigation { padding-top:max(20px,env(safe-area-inset-top)); padding-bottom:max(20px,env(safe-area-inset-bottom)); max-height:100dvh; }
  body .app-shell > section { scroll-margin-top:var(--workspace-header-height,80px); }
}

/* Mobile forms retain the same validation and explicit action handlers. */
@media (max-width:999px) {
  body .app-shell button, body .app-shell summary, body .app-shell a { min-width:44px !important; min-height:44px !important; }
  body .app-shell button { font-size:14px !important; line-height:1.35; }
  body .app-shell summary { padding-block:11px; line-height:22px; cursor:pointer; }
  body .app-shell input:not([type=checkbox]):not([type=radio]):not([type=hidden]), body .app-shell select, body .app-shell textarea { min-height:44px !important; font-size:16px !important; padding:10px; max-width:100%; min-width:0; }
  body .app-shell form label:not(:has(input[type=checkbox])):not(:has(input[type=radio])) { display:grid; gap:6px; }
  body .app-shell form label:has(input[type=checkbox]), body .app-shell form label:has(input[type=radio]) { min-height:48px; padding-block:8px; cursor:pointer; align-items:center; }
  body .app-shell .observation-work-confirmations input[type=checkbox] { width:24px !important; height:24px; flex-basis:24px; }
  body .app-shell .mobile-form-actions { position:sticky; bottom:var(--mobile-nav-height,78px); z-index:40; display:grid; grid-template-columns:minmax(0,1fr); gap:8px; width:100%; padding:12px 0; background:var(--bg); border-top:1px solid #d2ddd5; }
  body .app-shell .mobile-form-actions button { width:100%; min-height:48px; margin:0; border-radius:8px; }
  body .app-shell .mobile-form-actions button[type=submit] { background:#167038; border:1px solid #167038; color:#fff; font-weight:650; }
  body .app-shell .mobile-form-actions [data-check] { background:#edf5ef; color:#183f2e; border:1px solid #b8cdbf; }
  body .app-shell .mobile-form-actions :is([data-close],#cancelObservationButton) { background:#fff; border:1px solid #c8d5cc; color:#314d3d; font-weight:400; }
  body .app-shell form :is(input,select,textarea,details) { scroll-margin-block:var(--workspace-header-height,80px) 270px; }
  body .app-shell > .inline-action-confirmation { position:fixed; top:var(--workspace-header-height,80px); left:12px; right:12px; width:auto; max-height:calc(100dvh - var(--workspace-header-height,80px) - var(--mobile-nav-height,78px) - 20px); overflow-y:auto; z-index:850; box-shadow:0 8px 24px #04261b20; }
}

@media(max-width:999px) {
  body .app-shell .observation-create-actions:not(.mobile-form-actions), body #observationsPanel .observation-conversation-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  body .app-shell [data-mobile-camera-button], body .app-shell [aria-label="Выбрать фото из галереи"] { min-height:48px !important; width:100%; }
  body .app-shell .observation-photo-item { flex-wrap:wrap; min-width:0; }
  body .app-shell .mobile-photo-remove { width:100%; min-height:44px; }
}
.mobile-media-progress { display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:10px; font-size:14px; }
.mobile-media-progress progress { width:100%; height:8px; accent-color:#167038; }

.observation-actions > [data-create-reason] { flex-basis:100%; width:100%; }
@media(max-width:999px) {
  body .app-shell #fieldsPanel, body .app-shell #observationsPanel, body .app-shell #worksPanel, body .app-shell #economicsPanel, body .app-shell #weatherPanel, body .app-shell #aiSection { padding:12px; margin-block:12px; }
  body .field-group-parcels { padding-inline:0; }
  body .parcel-card-row { padding:12px; }
  body .app-shell #observationsPanel .observation-card { padding:12px 0; border:0; border-top:1px solid #d2ddd5; border-radius:0; box-shadow:none; }
  body .app-shell #observationsPanel .observation-work-form { padding:0; border:0; border-radius:0; width:100%; }
  body #observationsPanel .observation-conversation { margin:12px 0; border-radius:0; border-inline:0; }
  body #observationsPanel .observation-conversation-compose, body #observationsPanel .observation-conversation-messages { padding:8px 0; }
  body #observationsPanel .observation-conversation-messages { max-height:none; overflow-y:visible; }
  body .app-shell .observation-work-confirmations { font-size:14px; line-height:1.5; padding:10px; }
  body .app-shell .observation-work-confirmations :is(strong,ul,li,span) { font-size:14px !important; line-height:1.5; }
  body .app-shell .observation-work-confirmations ul { padding-left:20px; margin:8px 0; }
  body .app-shell .mobile-form-actions > [data-create-reason] { margin:0; padding:0; line-height:1.4; }
  body .app-shell .work-status, body .app-shell .econ-status-badge { border-radius:999px; padding:4px 10px; display:inline-block; line-height:1.4; }
  body .app-shell :is(.work-title,.observation-title,h2,h3,.observation-photo-name) { overflow-wrap:anywhere; max-width:100%; white-space:normal; }
  body .app-shell form :is([data-status],.observation-create-status) { min-height:1.4em; }
  body .app-shell .inline-action-notice, body .app-shell .inline-action-confirmation { grid-column:1/-1; }
  body .app-shell .weather-forecast-scroll, body .app-shell .econ-table-scroll { overflow:visible; }
  body .app-shell table[data-mobile-cards], body .app-shell table[data-mobile-cards] tbody { display:block; width:100%; min-width:0; }
  body .app-shell table[data-mobile-cards] thead { display:none; }
  body .app-shell table[data-mobile-cards] tr { display:block; margin:10px 0; padding:10px; border:1px solid #d2ddd5; border-radius:8px; }
  body .app-shell table[data-mobile-cards] td { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; padding:6px 0; text-align:left; white-space:normal; position:static; overflow-wrap:anywhere; }
  body .app-shell table[data-mobile-cards] td::before { content:attr(data-label); font-weight:600; }
  body .app-shell table[data-mobile-cards] td[colspan] { display:block; }
  body .app-shell table[data-mobile-cards] td[colspan]::before { content:none; }
}

/* Same Golos/green identity, with a readable phone type scale. */
@media(max-width:999px) {
  body .app-shell { font-size:14px; line-height:1.5; }
  body .app-shell :is(p,li,small,label,summary) { font-size:14px !important; }
  body .app-shell :is(.small,.hint,.chip,.season-metrics span,.season-metrics small,.map-group-label,.map-toolbar-hint,.map-note,.parcel-boundary-note,.observation-meta,.observation-ai-status,.observation-conversation-empty,.observation-photo-name,.observation-ai-source,.observation-work-context,.observation-upload-status,.work-date,.work-status,.works-summary-label,.work-field small,.works-field-label,.works-status-message,.work-meta div,.work-meta strong,.work-meta span,.econ-kpi span,.econ-scenario-badge,.econ-status-badge) { font-size:13px !important; line-height:1.5; }
  body .app-shell .observation-chain :is(strong,span), body .app-shell .observation-ai-result li { font-size:13px !important; }
  body .app-shell :is([style*="font-size: 12px"],[style*="font-size: 11px"],[style*="font-size: 10px"]) { font-size:13px !important; opacity:1 !important; }
  body .app-shell :is(.season-metrics small,.season-metrics span,.work-date,.works-summary-label,.observation-meta,.observation-ai-source) { color:#526456; opacity:1; }
  body .app-shell h2 { font-size:22px; }
  body .app-shell h3 { font-size:18px; }
  body .app-shell .hero-title { font-size:28px; }
  body .app-shell .topbar { padding-top:calc(6px + env(safe-area-inset-top)); }
  body .app-shell :is(.card,.observation-product-card,.econ-kpi,.econ-scenario) { border-radius:12px; box-shadow:none; }
  body .app-shell :is(input,select,textarea,button) { border-radius:8px; }
  body #mapPanel .farm-map { height:clamp(280px,52dvh,480px); }
}

@media(max-width:999px) {
  body .app-shell .field-group-parcels .parcel-row-actions button { font-size:14px !important; }
  body #createObservationStatus { font-size:13px !important; }
}

.mobile-search-label { display:grid; gap:6px; min-width:0; flex:1; font-size:14px; }
.mobile-search-label input { width:100%; }
.chat-form,.map-search-form { align-items:end; }
#workspaceParcelContext { display:none; }
@media(max-width:999px) {
  body .topbar #workspaceParcelContext { display:block; font-size:13px; line-height:1.35; color:#526456; overflow-wrap:anywhere; margin-top:2px; }
}
