/* ===== Telefon (ecran ingust) =====
   Aceleasi date si functii ca pe PC, dar fara instrumentele de administrare
   (aranjarea solelor, importuri, NDVI, RTK) si cu texte explicative ascunse. */
@media (max-width: 760px) {
  /* Antet: un singur rand - meniul derulabil si rotita de setari la capat; fara logo */
  #side .brand { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important;
    gap: 6px !important; padding: 6px 8px !important; min-height: 0 !important; }
  #side .brand h1.farm-brand, #side .brand > p { display: none !important; }
  #workspaceNav { order: 1; flex: 1 1 auto !important; min-width: 0 !important; display: flex !important; flex-wrap: nowrap !important;
    overflow-x: auto !important; gap: 2px !important; padding: 0 !important; margin: 0 !important; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #workspaceNav::-webkit-scrollbar { display: none; }
  #workspaceNav > *, #workspaceMore > summary { flex: 0 0 auto !important; white-space: nowrap !important; min-height: 38px;
    padding: 7px 10px !important; font-size: .95rem !important; margin: 0 !important; }
  #settingsLauncher { order: 2; position: static !important; flex: 0 0 auto !important; width: 38px !important; height: 38px !important;
    min-width: 38px !important; margin: 0 !important; padding: 0 !important; }
  #workspaceMore > div { position: fixed !important; top: 52px !important; right: 8px !important; left: auto !important; z-index: 3000 !important; }
  .farm-topbar { display: none !important; }              /* "Carolina Prodimpex 94 / Pagina" */
  input, select, textarea { font-size: 16px !important; }  /* fara zoom automat pe iPhone */
  .folder-badge { top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom)) !important; right: 10px !important;
    max-width: calc(100vw - 20px); font-size: .78rem !important; opacity: .92; }
  #finNotice, .crop-summary-note, .crop-lead { display: none !important; }
  /* Doar pe PC: SAGA, SPV, import facturi din fisiere, NDVI, Mediu/GAEC */
  [data-page="saga"], [data-page="mediu"], details.fin-breakdown:has(#finSpvStatus), .fin-upload:has(#finFiles),
  section.section:has(#ndviContext) { display: none !important; }

  /* Harta: harta pe tot ecranul; RTK doar pe PC; istoricul solei ca panou jos */
  #mapwrap { height: calc(100dvh - 78px) !important; min-height: 380px !important; }
  #rtkStatusBtn, #rtkPanel, .rtk-panel { display: none !important; }
  #history.history-floating { position: fixed !important; left: 8px !important; right: 8px !important; bottom: 8px !important;
    top: auto !important; width: auto !important; max-height: 46vh !important; overflow: auto !important; z-index: 1200 !important; }
  #history .history-row { grid-template-columns: 46px minmax(0,1fr) 70px !important; font-size: 13px !important; padding: 6px 4px !important; }
  #history .history-tools, #asolamentYearSelect { display: none !important; }
  #history.history-floating { bottom: 22px !important; }
  body:has(#history.show) .leaflet-right { display: none !important; }   /* zoom/straturi nu acopera panoul */
  .leaflet-control-attribution { font-size: 9px !important; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* Plan culturi: doar alegerea culturii pe sole. Aranjarea, importurile si exportul raman pe PC. */
  .crop-name-inline [data-arrange], #addFieldPart, #fieldArrangeDialog details, #removedPartsRecovery,
  #cropPlanExport, #applyExcelPlan, #rebuildExcelBox, #applyFieldCorrections, #cropHistoryDetails,
  #marginSettings, #addUndeclared, .crop-import { display: none !important; }
  /* Tabelul pe toata latimea telefonului; pe un an se vad Cultura, ha si Masura */
  #content { padding-left: 6px !important; padding-right: 6px !important; }
  #cropPlanSection .card.crop-plan { padding: 10px 6px !important; }
  #cropPlanSection .crop-table-wrap { border-radius: 8px !important; }
  #cropPlanSection #cropPlanHead tr:first-child th:nth-child(1), #cropPlanSection #cropPlanRows tr > td:nth-child(1),
  #cropPlanSection #cropPlanHead tr:first-child th:nth-child(3), #cropPlanSection #cropPlanRows tr > td:nth-child(3) { display: none !important; }
  #cropPlanSection .crop-table { table-layout: auto !important; }
  body.carolina-light #cropPlanSection .crop-table :is(th, td) { padding: 1px 2px !important; font-size: 12px !important; }
  body.carolina-light #cropPlanSection .crop-table thead th { font-size: 11px !important; padding: 2px 1px !important; height: auto !important; }
  /* 16px in campurile care se pot apasa: iPhone nu mai mareste singur pagina; marirea cu doua degete ramane posibila */
  body.carolina-light #cropPlanSection .crop-table :is(input, select) { font-size: 16px !important; height: 30px !important; min-height: 30px !important; padding: 1px 2px !important; }
  #cropPlanSection .crop-table thead tr:first-child th:nth-child(2), #cropPlanSection .crop-table tbody tr > th:nth-child(2) {
    width: 92px !important; min-width: 92px !important; max-width: 92px !important; left: 0 !important; }
  #cropPlanSection .crop-name-inline { width: 88px !important; }
  /* Numele solei se schimba doar pe PC; pe telefon e doar afisat (fara apasare = fara marire automata) */
  #cropPlanSection .crop-name-inline input[data-field=name] { font-size: 12px !important; font-weight: 700; pointer-events: none; }
  #cropPlanRows th > small { font-size: 9.5px !important; line-height: 11px !important; white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; }
  #cropPlanSection .crop-table td select[data-field=crop], #cropPlanSection .crop-table .part-cell {
    width: 104px !important; min-width: 104px !important; max-width: 104px !important; }
  #cropPlanSection .crop-table .part-cell { white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
    font-size: 13px !important; padding: 1px 3px !important; height: 28px !important; min-height: 28px !important; }
  #cropPlanSection .crop-table .part-cell .part-edit-icon { display: none !important; }
  #cropPlanSection .crop-table td input[data-field=ha] { width: 54px !important; min-width: 54px !important; max-width: 54px !important; }
  body.carolina-light #cropPlanSection .crop-table td select[data-field=measure] { width: 52px !important; min-width: 52px !important; max-width: 52px !important; font-size: 16px !important; }
  #cropPlanSection .crop-table tfoot th { min-width: 92px !important; font-size: 11px !important; }
  /* Suprafata solelor unite: casuta ca la celelalte (nu se editeaza aici) */
  #cropPlanSection .part-ha { display: block; box-sizing: border-box; width: 50px; height: 28px; line-height: 26px; text-align: right;
    padding: 0 3px; border: 1px solid #c9d3c3; border-radius: 6px; background: #f4f6f1; color: #2f432f; font-size: 13px; }
  #cropPlanSection .crop-table td input[data-field=ha] { width: 64px !important; min-width: 64px !important; max-width: 64px !important; }
  #cropPlanSection .crop-table td select[data-field=measure] { width: 58px !important; min-width: 58px !important; max-width: 58px !important; }
  #cropPlanSection .crop-table tfoot th { min-width: 118px !important; }
  #cropPlanSection .crop-table { table-layout: auto !important; }
  #cropPlanSection .crop-table td select[data-field=crop] { text-align: left !important; direction: ltr !important; }
  #fieldArrangeDialog { width: calc(100vw - 16px) !important; max-width: none !important; }
  #cropPlanRows th[scope=row] small { font-size: 11px !important; }
}
