/* Mobile-first polish for Bancal V82. */
html, body { max-width: 100%; overflow-x: hidden; }
#app, #app main, #app .map-card, #app .work-card { width: 100%; min-width: 0; max-width: 100%; }
.task-map-zoom { position: absolute; z-index: 3; right: 10px; top: 10px; display: grid; gap: 5px; }
.task-map-zoom button { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 1px solid #eaded6; border-radius: 10px; background: rgba(255,255,255,.95); box-shadow: 0 4px 14px rgba(50,35,28,.18); font-size: 21px; font-weight: 800; }
.login-card { width: calc(100vw - 24px); max-width: 420px; min-width: 0; }
button, a, input, select, textarea { min-height: 44px; }
textarea { resize: vertical; }
#openCalendar { order: -20; grid-column: 1 / -1; border: 2px solid #f66b36; background: linear-gradient(135deg,#fff7f0,#fff); }
#openCalendar .portal-icon { background: #f66b36; color: #fff; }
#openMyTasks { order: -19; }
.calendar-layout { grid-template-columns: minmax(0,1.45fr) minmax(320px,.55fr); align-items: start; }
.calendar-layout > .module-card:first-child { position: sticky; top: 12px; }
.calendar-nav h1 { text-transform: capitalize; text-align: center; }
.calendar-day { cursor: pointer; transition: background .15s, box-shadow .15s; }
.calendar-day:hover { background: #fff5ef; }
.calendar-day.selected { position: relative; z-index: 1; background: #fff0e8; box-shadow: inset 0 0 0 2px #f66b36; }
.calendar-status-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; font-size: 12px; color: var(--muted); }
.calendar-status-legend span { padding: 5px 8px; border-radius: 20px; background: #f7f1ed; }
.agenda-filter-title { margin: 16px 0 8px; font-weight: 800; }
.new-event-toggle { width: 100%; margin: 8px 0 16px; padding: 12px; border: 0; border-radius: 11px; background: var(--green2); color: var(--green); font-weight: 850; }
.task-item-head > b { flex: 0 0 auto; font-size: 12px; }
.module-card label { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .login-shell { padding: 12px; }
  header { min-height: 62px; height: auto; padding: 9px 12px; gap: 8px; }
  header > div:first-child { min-width: 0; }
  header strong { display: block; overflow: hidden; font-size: 16px; white-space: nowrap; text-overflow: ellipsis; }
  .header-actions { flex: 0 0 auto; gap: 5px; }
  .header-actions .quiet { min-height: 40px; padding: 7px 9px; }
  .portal-main { padding: 18px 12px 28px; }
  .portal-heading h1 { font-size: clamp(28px,9vw,39px); }
  .portal-card { min-height: 104px; padding: 15px; gap: 12px; text-align: left; }
  #openCalendar { min-height: 124px; }
  .portal-card small { line-height: 1.35; }
  .module-main { width: 100%; padding: 0 8px 24px; }
  #app > header { padding-top: env(safe-area-inset-top); }
  body:has(#app.map-mode:not([hidden])) { padding-bottom: 0; }
  #app.map-mode { display: grid; grid-template-rows: auto minmax(0,1fr); width: 100vw; max-width: 100vw; height: 100dvh; }
  #app.map-mode main { width: 100vw; max-width: 100vw; height: auto; min-height: 0; }
  #app .map-toolbar { width: 100%; min-width: 0; overflow: hidden; }
  #app .field-flight { flex: 1 1 auto; min-width: 0; }
  #app .field-picker { flex: 1 1 auto; min-width: 0; }
  #app .field-picker select { width: 100%; min-width: 0; max-width: 100%; }
  #app .flight-date { flex: 0 0 auto; min-width: 74px; }
  #app .locate { flex: 0 0 auto; max-width: 108px; padding-inline: 9px; white-space: nowrap; }
  #app .location-summary { min-width: 0; }
  #app .location-summary > div { min-width: 0; }
  #app .location-summary b, #app .location-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #app .health-legend { max-width: calc(100% - 78px); flex-wrap: wrap; }
  #app .map-choice { max-width: calc(100% - 20px); }
  .module-card { width: 100%; min-width: 0; padding: 14px; overflow: hidden; }
  .calendar-layout { display: flex; flex-direction: column; }
  .calendar-layout > .module-card:first-child { position: static; width: 100%; order: 0; }
  .calendar-layout > .module-card:last-child { width: 100%; order: 1; }
  .calendar-nav { position: sticky; top: 0; z-index: 4; margin: -14px -14px 0; padding: 12px 14px 9px; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
  .calendar-nav h1 { max-width: calc(100% - 100px); margin: 0; font-size: 21px; }
  .calendar-week { margin-top: 10px; }
  .calendar-day { min-width: 0; min-height: 60px; padding: 4px 3px; }
  .calendar-day strong { font-size: 12px; }
  .calendar-entry { display: block; width: 8px; height: 8px; margin: 3px auto 0; border-radius: 50%; font-size: 0; }
  .calendar-entry + .calendar-entry { display: inline-block; margin-left: 2px; }
  .calendar-status-legend { justify-content: center; }
  .agenda-item { overflow: hidden; }
  .agenda-item b, .agenda-item small { overflow-wrap: anywhere; }
  .grid.two, .grid.amount-grid { grid-template-columns: 1fr; }
  .task-item-head { align-items: start; }
  .task-actions { display: grid; grid-template-columns: 1fr; }
  .task-actions button, .task-actions a { display: grid; place-items: center; width: 100%; min-height: 46px; }
  .task-location { padding: 11px; }
  .task-location #taskMapWrap { height: min(54vh,430px); }
  .users-layout { display: flex; flex-direction: column; }
  .user-item > div { flex-wrap: wrap; }
  .user-item button { flex: 1; min-width: 100px; }
  .treatment-main, main { min-width: 0; }
  .treatment-map-toolbar { height: auto; min-height: 70px; align-items: stretch; flex-direction: column; }
  .field-number-legend { overflow-x: auto; }
  footer { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 390px) {
  header .eyebrow { font-size: 9px; }
  header strong { max-width: 185px; font-size: 14px; }
  .header-actions .quiet { padding-inline: 6px; font-size: 11px; }
  .calendar-day { min-height: 54px; }
  .calendar-status-legend { font-size: 10px; }
  .module-card { padding: 11px; }
  #app .map-toolbar { padding-inline: 7px; gap: 5px; }
  #app .locate { max-width: 82px; font-size: 12px; }
  #app .gps-icon { display: none; }
  #app .flight-date { min-width: 66px; }
}
