/* Agri-Agenda Desktop 2.0 — standalone only.
   Activated by desktop-shell.js on non-touch desktop fine-pointer viewports.
   No selector below applies to iPhone, touch iPad, or Wix recovery. */
html[data-agri-desktop-shell="on"] {
  --agri-desktop-header: 74px;
  --agri-desktop-rail: 184px;
  --agri-desktop-gap: 1rem;
  height: auto !important;
  min-height: 100%;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
html[data-agri-desktop-shell="on"] body {
  display: grid !important;
  grid-template-columns: var(--agri-desktop-rail) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: auto !important;
  min-height: 100dvh !important;
  overflow: visible !important;
  background: var(--canvas);
}
html[data-agri-desktop-shell="on"] body > header {
  grid-area: 1 / 1 / 2 / -1;
  position: sticky !important;
  top: 0;
  z-index: var(--z-header);
  min-height: var(--agri-desktop-header);
  padding: .7rem clamp(1rem, 2vw, 1.85rem) !important;
  background: #770505 !important;
  background-image: none !important;
  border-bottom: 1px solid rgb(57 0 0 / 18%);
  box-shadow: 0 1px 0 rgb(0 0 0 / 9%) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html[data-agri-desktop-shell="on"] body > header .header-inner {
  width: 100%;
  max-width: none !important;
  margin: 0;
}
html[data-agri-desktop-shell="on"] body > header .header-top,
html[data-agri-desktop-shell="on"] body > header .header-top.has-back,
html[data-agri-desktop-shell="on"] body > header .header-top.is-staff-view {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 49px;
}
html[data-agri-desktop-shell="on"] body > header #headerNav,
html[data-agri-desktop-shell="on"] body > header #dashStaffLinksBtn {
  display: none !important;
}
html[data-agri-desktop-shell="on"] body > header .header-top-actions,
html[data-agri-desktop-shell="on"] body > header .header-top.is-staff-view .header-top-actions {
  display: flex !important;
  align-items: center;
  gap: .8rem;
  margin-left: auto;
}
html[data-agri-desktop-shell="on"] body > header .brand strong {
  font-size: 1.58rem !important;
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: -.028em;
}
html[data-agri-desktop-shell="on"] body > header .brand-subtitle {
  margin-top: .16rem;
  font-size: .81rem !important;
  line-height: 1.3;
}
html[data-agri-desktop-shell="on"] #agriDesktopSearch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 40px;
  padding: .53rem .95rem;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 12px;
  background: rgb(255 255 255 / 9%);
  color: #fff;
  font-size: .9rem;
  font-weight: 610;
  transition: background-color .16s ease, border-color .16s ease;
}
html[data-agri-desktop-shell="on"] #agriDesktopSearch[hidden] { display: none !important; }
html[data-agri-desktop-shell="on"] #agriDesktopSearch svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html[data-agri-desktop-shell="on"] #agriDesktopSearch:is(:hover, [aria-current="page"]) {
  background: rgb(255 255 255 / 18%);
  border-color: rgb(255 255 255 / 50%);
}
html[data-agri-desktop-shell="on"] #agriDesktopSidebar {
  grid-area: 2 / 1 / 3 / 2;
  position: sticky;
  top: var(--agri-desktop-header);
  align-self: start;
  display: block;
  width: var(--agri-desktop-rail);
  height: calc(100dvh - var(--agri-desktop-header));
  min-height: 320px;
  padding: 1.3rem .7rem 1rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line-soft);
  background: var(--surface);
}
html[data-agri-desktop-shell="on"] #agriDesktopSidebar[hidden] { display: none !important; }
html[data-agri-desktop-shell="on"] .agri-desktop-nav {
  display: grid;
  align-content: start;
  gap: .3rem;
}
html[data-agri-desktop-shell="on"] .agri-desktop-nav__caption {
  display: block;
  padding: 0 .72rem .4rem;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 760;
  letter-spacing: .08em;
  text-transform: uppercase;
}
html[data-agri-desktop-shell="on"] .agri-desktop-nav__caption--secondary { margin-top: 1.2rem; }
html[data-agri-desktop-shell="on"] .agri-desktop-nav button {
  display: flex;
  align-items: center;
  gap: .68rem;
  min-width: 0;
  min-height: 45px;
  padding: .62rem .7rem;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 590;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
html[data-agri-desktop-shell="on"] .agri-desktop-nav button svg {
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html[data-agri-desktop-shell="on"] .agri-desktop-nav button:hover {
  background: var(--surface-muted);
}
html[data-agri-desktop-shell="on"] .agri-desktop-nav button.is-active {
  border-color: rgb(119 5 5 / 8%);
  background: #f7e9e9;
  color: #770505;
  font-weight: 760;
}
html[data-theme="dark"][data-agri-desktop-shell="on"] .agri-desktop-nav button.is-active {
  border-color: #553033;
  background: #251417;
  color: #ffadb1;
}
html[data-agri-desktop-shell="on"] :is(.agri-desktop-nav button, #agriDesktopSearch):focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
html[data-agri-desktop-shell="on"] body > main {
  grid-area: 2 / 2 / 3 / 3;
  width: 100% !important;
  min-width: 0;
  max-width: none !important;
  margin: 0 !important;
  padding: .95rem clamp(1rem, 2vw, 1.75rem) 1.6rem !important;
  overflow: visible !important;
}
html[data-agri-desktop-shell="on"] body > main :is(#viewDash, #dashSurface, .dash-shell, .home-calendar) {
  width: 100%;
  max-width: none !important;
  min-width: 0;
}
html[data-agri-desktop-shell="on"] .home-calendar {
  gap: .72rem;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-month-view {
  display: grid;
  grid-template-rows: auto auto;
  gap: .82rem;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-month-nav { min-height: 48px; gap: .65rem; }
html[data-agri-desktop-shell="on"] .home-calendar .calendar-month-label {
  font-size: clamp(1.45rem, 2.05vw, 1.92rem);
  font-weight: 790;
  line-height: 1.2;
}
html[data-agri-desktop-shell="on"] .home-calendar :is(.calendar-month-step, .calendar-today) {
  min-height: 42px;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-workspace {
  grid-template-columns: minmax(0, 1.86fr) minmax(290px, 1fr) !important;
  grid-template-rows: auto !important;
  gap: var(--agri-desktop-gap) !important;
  align-items: stretch !important;
  height: auto !important;
  min-height: 0 !important;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-grid-card {
  min-width: 0;
  width: 100% !important;
  height: auto !important;
  border-radius: 18px;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-grid {
  width: 100%;
  height: auto !important;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-button {
  min-height: clamp(88px, 12dvh, 116px) !important;
  padding: .55rem .58rem;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-button__number {
  min-width: 30px;
  height: 30px;
  font-size: .96rem;
  font-weight: 760;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-grid__weekday {
  padding-block: .69rem;
  font-size: .77rem;
  letter-spacing: .055em;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-legend {
  padding: .7rem .9rem;
  font-size: .79rem;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-panel,
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-panel.is-open,
html[data-theme="dark"][data-agri-desktop-shell="on"] .home-calendar .calendar-day-panel {
  top: calc(var(--agri-desktop-header) + .8rem) !important;
  align-self: stretch !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100dvh - var(--agri-desktop-header) - 1.7rem) !important;
  padding: 1.12rem !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  align-content: stretch;
  gap: 1rem !important;
  overflow-y: auto !important;
  border-radius: 18px !important;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-panel h2 {
  font-size: clamp(1.16rem, 1.5vw, 1.35rem);
  line-height: 1.25;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-meta { font-size: .85rem; }
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-weather__status { font-size: .81rem; }
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-weather__rain { font-size: .74rem; }
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-weather__icon { font-size: 1.5rem; }
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-panel:has(.calendar-day-empty) .calendar-day-events {
  align-content: center;
  justify-items: center;
  text-align: center;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-day-empty {
  color: var(--muted);
  font-size: .99rem;
  line-height: 1.5;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-event-card__title,
html[data-agri-desktop-shell="on"] .home-calendar .calendar-external-card__title { font-size: 1.06rem; }
html[data-agri-desktop-shell="on"] .home-calendar .calendar-next-event {
  justify-self: start !important;
  align-self: end !important;
  width: fit-content !important;
  max-width: 100%;
}
html[data-agri-desktop-shell="on"] .dash-staff-page { max-width: 1160px; }
html[data-agri-desktop-shell="on"] [data-mode="stats"] .dash-staff-page { max-width: none; }
html[data-agri-desktop-shell="on"] body > main.main--detail-view { max-width: none !important; }
html[data-agri-desktop-shell="on"] #viewEvent > .panel { max-width: 1180px; margin-inline: auto; }
html[data-agri-desktop-shell="on"] .calendar-search-page { max-width: 1060px; }
html[data-agri-desktop-shell="on"] .weekly-recap-shell { max-width: 1180px; }

/* Compact Mac/browser windows: icons-only rail gives the calendar priority. */
@media screen and (max-width: 1279px) {
  html[data-agri-desktop-shell="on"] { --agri-desktop-rail: 68px; --agri-desktop-gap: .85rem; }
  html[data-agri-desktop-shell="on"] #agriDesktopSidebar { padding-inline: .42rem; }
  html[data-agri-desktop-shell="on"] .agri-desktop-nav__caption { display: none; }
  html[data-agri-desktop-shell="on"] .agri-desktop-nav button {
    justify-content: center;
    min-height: 46px;
    padding: .65rem .4rem;
    margin-bottom: .25rem;
  }
  html[data-agri-desktop-shell="on"] .agri-desktop-nav button span { display: none; }
  html[data-agri-desktop-shell="on"] .agri-desktop-nav button svg { width: 21px; height: 21px; flex-basis: 21px; }
  html[data-agri-desktop-shell="on"] .home-calendar .calendar-workspace {
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr) !important;
  }
}
@media screen and (max-width: 1120px) {
  html[data-agri-desktop-shell="on"] #agriDesktopSearch {
    padding: .55rem;
    width: 42px;
  }
  html[data-agri-desktop-shell="on"] #agriDesktopSearch span { display: none; }
  html[data-agri-desktop-shell="on"] body > main { padding-inline: .9rem !important; }
  html[data-agri-desktop-shell="on"] .home-calendar .calendar-workspace {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr) !important;
    gap: .75rem !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  html[data-agri-desktop-shell="on"] :is(.agri-desktop-nav button, #agriDesktopSearch) { transition: none; }
}
@media print {
  #agriDesktopSidebar, #agriDesktopSearch { display: none !important; }
  html[data-agri-desktop-shell="on"] body { display: block !important; }
  html[data-agri-desktop-shell="on"] body > main { display: block; width: 100% !important; padding: 0 !important; }
}

/* Desktop month: one six-week calendar exactly fits the usable viewport.
   Other sections and the event list retain natural document scrolling.
   For extremely short desktop windows (<640px), prefer accessible scrolling
   over truncating dates and keyboard targets. */
@media screen and (min-height: 640px) {
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"]:has(#viewDash[data-mode="dash"]):not(:has(.aa-auth-overlay)) {
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] body:has(#viewDash[data-mode="dash"]) {
    height: 100dvh !important;
    min-height: 0 !important;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] body > main {
    display: flex;
    flex-direction: column;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding-block: .48rem .55rem !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] #viewDash[aria-hidden="false"] {
    flex: 1 1 auto;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] #viewDash[aria-hidden="false"] :is(#dashSurface, .dash-shell) {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar {
    display: flex;
    flex-direction: column;
    height: 100% !important;
    min-height: 0 !important;
    gap: .4rem;
    overflow: hidden !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-toolbar {
    flex: 0 0 auto;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar #calendarMonthView:not([hidden]) {
    flex: 1 1 auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: .5rem;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-month-nav {
    min-height: 44px;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-workspace {
    height: 100% !important;
    min-height: 0 !important;
    align-items: stretch !important;
    overflow: hidden;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-grid-card {
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-grid {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-grid__days {
    display: grid !important;
    grid-template-rows: repeat(6, minmax(0, 1fr));
    height: 100% !important;
    min-height: 0 !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar :is(.calendar-grid__week, .calendar-day-cell) {
    min-height: 0 !important;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-grid__weekday {
    padding-block: .5rem;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-day-button {
    height: 100% !important;
    min-height: 0 !important;
    padding: clamp(.17rem, .7dvh, .42rem) .48rem;
    gap: .18rem;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-legend {
    padding-block: .37rem;
  }
  html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar :is(
    .calendar-day-panel,
    .calendar-day-panel.is-open
  ),
  html[data-theme="dark"][data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] .home-calendar .calendar-day-panel {
    position: static !important;
    height: 100% !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
}

/* Desktop search: show the existing accessible input in the header action
   position while the original search panel occupies the full main workspace.
   Input stays a DOM child of the panel: keydown, focus and server search stay
   connected without cloning inputs or changing the search API. */
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"]:has(#viewDash[data-mode="search"]) {
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] body:has(#viewDash[data-mode="search"]) {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] body > main {
  height: 100% !important;
  min-height: 0 !important;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden !important;
  padding: 0 !important;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #viewDash[aria-hidden="false"] {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  animation: none !important;
  transform: none !important;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #viewDash :is(#dashSurface, .dash-shell) {
  /* The search page is nested inside both wrappers in the PWA DOM.
     Keep them present; only #dashContainer itself is hidden by app.js. */
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchPanel.calendar-search-page {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: clamp(1rem, 2vw, 2rem) !important;
  gap: .75rem;
  border: 0;
  border-radius: 0;
  background: var(--canvas);
  overflow: hidden !important;
  animation: none !important;
  transform: none !important;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchPanel > label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchInput {
  position: fixed !important;
  z-index: calc(var(--z-header) + 1);
  top: var(--agri-search-top, 16px);
  right: var(--agri-search-right, 24px);
  width: min(420px, calc(100vw - 290px)) !important;
  max-width: calc(100vw - 290px);
  height: 42px;
  min-height: 42px;
  padding: .5rem .85rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: .95rem;
  line-height: 1.35;
  box-shadow: 0 0 0 2px rgb(255 255 255 / 8%);
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #agriDesktopSearch {
  visibility: hidden;
  pointer-events: none;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchInstruction {
  padding: 0 0 .85rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: .92rem;
  line-height: 1.5;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchResults {
  height: 100%;
  min-height: 0;
  max-height: none !important;
  padding: 0 clamp(.1rem, .75vw, .65rem);
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] .calendar-search-result {
  padding-block: .95rem;
}

/* Chromium on macOS can interpret two-finger horizontal trackpad overscroll
   as Back/Forward before the calendar's non-passive wheel listener runs.
   Suppress that browser-level navigation at the scrolling root, but ONLY
   while the standalone desktop month is on screen. Other desktop views
   retain normal browser history gestures; touch/iPad never enters this shell. */
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"],
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] body,
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="calendar"] #calendarGrid {
  overscroll-behavior-x: none;
}


/* Search refinement for desktop: keep the one real input in the red header,
   place clear within it, and give results a comfortable reading column. */
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchPanel.calendar-search-page {
  grid-template-columns: minmax(0, 1fr) 44px;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  padding: clamp(1.2rem, 2.4vw, 2.2rem) clamp(1rem, 3vw, 3rem) !important;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchInput {
  min-height: 42px;
  padding: .5rem 3rem .5rem 2.65rem;
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23827972' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-position: 13px center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 7%);
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchClear {
  position: fixed;
  z-index: calc(var(--z-header) + 2);
  top: calc(var(--agri-search-top, 16px) + 2px);
  right: calc(var(--agri-search-right, 24px) + 3px);
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchInstruction {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  width: min(100%, 920px);
  margin: 0;
  padding: .2rem .25rem 1.1rem;
  border: 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchResults {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: center;
  width: min(100%, 920px);
  height: 100%;
  min-height: 0;
  max-height: none !important;
  margin: 0;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
html[data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] .calendar-search-result {
  min-height: 78px;
  padding-block: 1rem;
}
html[data-theme="dark"][data-agri-desktop-shell="on"][data-agri-desktop-screen="search"] #calendarSearchInput {
  background-color: var(--surface-muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20' fill='none' stroke='%23b1a7a5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
}


/* Elenco classico desktop: stessa sequenza per data del touch, con righe leggibili. */
html[data-agri-desktop-shell="on"] .home-calendar .calendar-agenda-view {
  width: min(100%, 1040px);
  margin-inline: auto;
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-agenda-day {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-agenda-day__events,
html[data-agri-desktop-shell="on"] .home-calendar .calendar-agenda-day .calendar-external-section__list {
  grid-template-columns: minmax(0, 1fr);
}
html[data-agri-desktop-shell="on"] .home-calendar .calendar-agenda-day .calendar-external-section {
  grid-column: 1;
}
@media (max-height: 860px) and (hover: hover) and (pointer: fine) {
  html[data-agri-desktop-shell="on"] .home-calendar .calendar-agenda-view {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .35rem .3rem 1.25rem;
  }
  html[data-agri-desktop-shell="on"] .home-calendar .calendar-agenda-list {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

/* Time Machine: avoid overlaying the desktop navigation rail. */
html[data-agri-desktop-shell="on"] body > .calendar-agenda-return {
  inset-inline-end: max(1.5rem, var(--safe-right));
  bottom: calc(1.5rem + var(--safe-bottom));
}

/* Desktop Elenco: the desktop shell explicitly marks the agenda as screen
   "other", not "calendar". A compact-screen height/overflow constraint can
   truncate its timeline, and an internal scroller that is not height-bound
   does not help on taller Mac windows. Let the *document* scroll in agenda
   mode at any Mac height, while leaving the fixed-size month calendar,
   secondary screens, tablet and phone layouts completely untouched. */
html[data-agri-desktop-shell="on"]:has(#viewDash[aria-hidden="false"] #calendarAgendaView:not([hidden])) {
  height: auto !important;
  min-height: 100%;
  overflow-y: auto !important;
}
html[data-agri-desktop-shell="on"]:has(#viewDash[aria-hidden="false"] #calendarAgendaView:not([hidden])) body {
  height: auto !important;
  min-height: 100dvh !important;
  overflow: visible !important;
}
html[data-agri-desktop-shell="on"]:has(#viewDash[aria-hidden="false"] #calendarAgendaView:not([hidden])) :is(
  body > main, #viewDash, #dashSurface, .dash-shell, .home-calendar, #calendarAgendaView
) {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}
