/* The phone workspace uses the existing editors and a single sheet at a time. */
.planner-mobile-only,
.planner-mobile-sheet-header,
.planner-mobile-sheet-footer,
.planner-mobile-note-done { display: none; }

@media (max-width: 900px), (max-width: 1100px) and (pointer: coarse) {
  /* Bed deletion belongs to bed editing, where crop dragging is disabled. */
  .pianification-layout-shell:not([data-mobile-mode="beds"]) .bed-delete { display: none; }
  .pianification-layout-shell {
    --mobile-dock-height: calc(66px + env(safe-area-inset-bottom, 0px));
    position: relative;
    height: calc(100dvh - 57px);
    height: var(--planner-mobile-height, calc(100dvh - 57px));
    padding-bottom: var(--mobile-dock-height);
    isolation: isolate;
  }
  .pianification-layout-shell .pianification-center-main-shell { flex: 1 1 100%; width: 100%; }
  .pianification-layout-shell :is(.pianification-shell-resizer, .pianification-section-resizer, .pianification-right-rail),
  #pianification-garden-toolbar-23f1 { display: none !important; }
  .pianification-left-section-resizer { display: none !important; }
  body:not(.planner-accessory-drawing) [data-accessory-drawing-indicator] { display: none !important; }
  .pianification-center-header { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 0; padding: 4px 8px; }
  .pianification-center-header-left { display: none; }
  .planner-garden-header-dropdown-row { width: 100%; min-width: 0; }
  .planner-garden-dropdown { width: 100%; max-width: 100%; }
  .planner-garden-dropdown-toggle { width: 100%; min-height: 40px; max-width: 100%; justify-content: flex-start; }
  .planner-garden-dropdown-label { flex: 1; text-align: left; }
  .planner-garden-dropdown-menu { position: static; width: 100%; max-width: 100%; max-height: 35dvh; overflow-y: auto; margin-bottom: 12px; }
  #planner-mobile-garden-host { margin-bottom: 12px; }
  #planner-mobile-garden-host .planner-garden-dropdown-toggle { margin-bottom: 0; }
  #planner-mobile-garden-host .planner-garden-dropdown-row { grid-template-columns: minmax(0, 1fr) 44px 44px; }
  #planner-mobile-garden-host :is(.planner-garden-dropdown-rename, .planner-garden-dropdown-delete) { padding: 8px; justify-content: center; }
  .pianification-center-header-week { display: flex; flex: 1 1 100%; width: 100%; min-width: 0; max-width: none; gap: 4px; padding: 0; }
  .pianification-week-control { flex: 1; width: auto; min-width: 0; max-width: none; }
  .pianification-week-meta { gap: 5px; font-size: 11px; }
  .pianification-center-header-week .pianification-header-icon-btn { min-width: 40px; min-height: 40px; }
  .pianification-center-header-week #week-today-btn { position: static; flex: 0 0 auto; inline-size: max-content; min-inline-size: 46px; height: 40px; min-height: 40px; padding: 4px 7px; font-size: 11px; white-space: nowrap; }
  #week-slider { min-height: 24px; }
  #gardenTabsContent { min-height: 0; }
  .planner-viewport-container { touch-action: none; overscroll-behavior: none; }
  .planner-viewport-wrapper, .bed, .bed * { -webkit-touch-callout: none; }
  .pianification-layout-shell[data-mobile-mode="navigate"] :is(.bed, .placed-plant),
  .pianification-layout-shell[data-mobile-mode="fill"] :is(.bed, .placed-plant) { cursor: grab !important; }
  .pianification-layout-shell:is([data-mobile-mode="area"], [data-mobile-mode="repeat"]) .bed { cursor: crosshair !important; }

  .planner-mobile-only:not([hidden]) { display: flex; }
  .planner-mobile-only[hidden] { display: none !important; }
  .planner-mobile-dock {
    position: absolute; z-index: 270; inset: auto 0 0;
    height: var(--mobile-dock-height); align-items: stretch;
    padding: 5px max(4px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    gap: 2px; background: var(--pianif-surface-1); border-top: 1px solid var(--pianif-border-soft);
  }
  .planner-mobile-dock > button {
    display: flex; flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 4px 0; border: 0; border-radius: 9px;
    color: var(--pianif-text-muted); background: transparent; font-size: 11px; line-height: 1.3;
  }
  .planner-mobile-dock > button[aria-expanded="true"] { background: var(--pianif-active); color: var(--pianif-sage-300); }
  .planner-mobile-dock svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
  body:not(.planner-tutorial-active) .pianification-layout-shell[data-mobile-catalog-expanded="true"] #left-sidebar {
    --mobile-sheet-max-height: calc(var(--planner-mobile-viewport-height, 100dvh) - var(--mobile-dock-height) - 8px);
    --mobile-sheet-live-height: min(var(--mobile-sheet-height, var(--mobile-sheet-max-height)), var(--mobile-sheet-max-height));
    position: fixed !important;
    inset: calc(var(--planner-mobile-viewport-top, 0px) + var(--planner-mobile-viewport-height, 100dvh) - var(--mobile-dock-height) - var(--mobile-sheet-live-height)) auto auto var(--planner-mobile-viewport-left, 0px) !important;
    width: var(--planner-mobile-viewport-width, 100vw);
    height: var(--mobile-sheet-live-height);
    max-height: var(--mobile-sheet-max-height);
    border-radius: 12px 12px 0 0;
  }
  body:not(.planner-tutorial-active):has(.pianification-layout-shell[data-mobile-catalog-covers-header="true"]) > .site-header { visibility: hidden; }
  .planner-mobile-dock button:focus-visible,
  .planner-mobile-workbar button:focus-visible,
  .planner-mobile-sheet button:focus-visible { outline: 2px solid var(--pianif-sage-300); outline-offset: -2px; }

  .pianification-layout-shell #left-sidebar,
  .pianification-layout-shell #pianification-right-sidebar,
  .planner-mobile-sheet {
    display: none !important; position: absolute !important; z-index: 260;
    inset: auto 0 var(--mobile-dock-height) !important;
    width: 100%; min-width: 0; max-width: none;
    height: var(--mobile-sheet-height, min(66%, 640px)); min-height: 0; max-height: calc(100% - var(--mobile-dock-height) - 24px);
    border: 1px solid var(--pianif-border-strong); border-bottom: 0; border-radius: 18px 18px 0 0;
    background: var(--pianif-surface-1); color: var(--pianif-text);
    padding: 0 !important; overflow: hidden; box-shadow: 0 -8px 30px rgb(0 0 0 / 20%);
  }
  .pianification-layout-shell:is([data-mobile-panel="plants"], [data-mobile-panel="patterns"]) #left-sidebar,
  .pianification-layout-shell[data-mobile-panel="right"] #pianification-right-sidebar:not([hidden]),
  .pianification-layout-shell:is([data-mobile-panel="beds"], [data-mobile-panel="more"]) #planner-mobile-tools {
    display: flex !important; flex-direction: column;
  }
  .pianification-layout-shell[data-mobile-panel="plants"] #pattern-section,
  .pianification-layout-shell[data-mobile-panel="patterns"] #pianification-left-catalog-section { display: none !important; }
  .pianification-layout-shell[data-mobile-panel="plants"] #plants-bottom { display: none !important; }
  .pianification-layout-shell[data-mobile-panel="patterns"] #plants-bottom { display: contents !important; }
  .pianification-layout-shell[data-mobile-panel="patterns"] #pattern-section { flex: 1 1 auto !important; height: auto !important; min-height: 0; }
  .pianification-layout-shell #left-sidebar .left-body { flex: 1 1 0; min-height: 0; overflow: hidden; padding: 0 10px; }
  .pianification-layout-shell #pianification-left-catalog-section { flex: 1 1 0 !important; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .pianification-layout-shell #left-sidebar #plants-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
  .pianification-layout-shell #left-sidebar .plant-item { min-height: 86px; }
  .pianification-layout-shell #left-sidebar .plant-item img { touch-action: pan-y !important; }
  .pianification-layout-shell #left-sidebar .plant-label { font-size: 12px; line-height: 1.3; }
  .pianification-layout-shell #left-sidebar .consoc-drawer { flex: 0 1 148px; grid-template-rows: 44px minmax(0, 1fr); min-height: 44px; max-height: 148px; margin: 0; transition: none; }
  .pianification-layout-shell #left-sidebar .consoc-drawer[data-expanded="false"] { flex-basis: 44px; max-height: 44px; }
  .pianification-layout-shell #left-sidebar .consoc-drawer[data-expanded="true"][data-has-items="true"] {
    flex: 0 0 var(--mobile-consoc-expanded-height, 134px);
    max-height: var(--mobile-consoc-expanded-height, 134px);
  }
  .pianification-layout-shell[data-mobile-catalog-writing="true"] #left-sidebar .consoc-drawer[data-expanded="true"][data-has-items="true"] {
    max-height: clamp(44px, calc(100% - 122px), 134px);
  }
  .consoc-drawer .consoc-drawer-header { grid-template-columns: 44px minmax(0, 1fr) auto 44px; gap: 2px; }
  .consoc-drawer-labels { flex-direction: column; align-items: stretch; gap: 2px; }
  .pianification-layout-shell #left-sidebar .consoc-drawer :is(#consoc-plant-btn, #consoc-bad-btn, #consoc-period-btn, .consoc-drawer-toggle) { width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 10px; }
  .pianification-layout-shell #left-sidebar .consoc-reference-plant { --mobile-consoc-image-size: 36px; }
  .pianification-layout-shell #left-sidebar .consoc-reference-plant .plant-item { width: 44px; min-height: 44px; justify-content: center; }
  .pianification-layout-shell #left-sidebar .consoc-drawer .img-thumbnail {
    width: var(--mobile-consoc-image-size, 44px) !important; height: var(--mobile-consoc-image-size, 44px) !important;
    min-width: var(--mobile-consoc-image-size, 44px); min-height: var(--mobile-consoc-image-size, 44px);
    max-width: var(--mobile-consoc-image-size, 44px); max-height: var(--mobile-consoc-image-size, 44px);
    flex: 0 0 var(--mobile-consoc-image-size, 44px); object-fit: contain;
  }
  .pianification-layout-shell #left-sidebar .consoc-drawer .plant-family { --mobile-consoc-image-size: var(--folder-preview-image-size); }
  .consoc-reference-plant .plant-label { display: none; }
  .pianification-layout-shell #left-sidebar .consoc-drawer #consociations-row { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 4px; padding: 4px 0; touch-action: pan-y; }
  .pianification-layout-shell #left-sidebar #consociations-row .plant-item { min-height: 80px; min-width: 0; }
  .pianification-layout-shell #left-sidebar .pianification-left-controls { padding: 4px 0; }
  .pianification-layout-shell #left-sidebar .pianification-left-command-row { grid-template-columns: minmax(0, 1fr) auto 38px; align-items: center; gap: 6px; }
  .pianification-layout-shell #left-sidebar :is(#search-bar, #group-toggle, .pianification-seed-control) { box-sizing: border-box; height: 38px !important; min-height: 38px !important; margin: 0; line-height: 1.2; }
  .pianification-layout-shell #left-sidebar .pianification-seed-control { padding: 6px 8px; font-size: 12px; }
  .pianification-layout-shell #left-sidebar .pianification-left-search-wrap { min-width: 0; }
  .pianification-layout-shell #left-sidebar #plants-list { height: auto !important; max-height: none !important; padding-bottom: 10px !important; }
  .pianification-layout-shell #left-sidebar #pattern-section .planner-mobile-sheet-header :is(.pattern-add-btn, .pattern-keep-active) { height: 40px; min-height: 40px; }
  .pianification-layout-shell #left-sidebar .plant-group-toggle { min-width: 0; }
  .pianification-layout-shell #left-sidebar .pattern-keep-active { min-width: 44px; }
  .pianification-layout-shell .pianification-right-section { margin: 0; padding: 10px; min-height: 0 !important; flex: 1 1 0 !important; }
  .pianification-layout-shell [data-pianification-panel-pin] { display: none !important; }
  /* Unify the accessory sheet with the other panels. */
  #pianification-right-accessories-section:not([hidden]) { position: static; width: 100%; height: auto; max-height: none; border: 0; border-radius: 0; }
  #pianification-right-automatic-section:not([hidden]) { position: static; inset: auto; width: 100%; height: auto; max-height: none; padding: 10px !important; border: 0 !important; border-radius: 0 !important; }
  #pianification-right-automatic-section > .automatic-garden-header { display: none; }
  .planner-accessory-panel-close { display: none; }
  .planner-mobile-sheet-header {
    position: relative; display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between;
    gap: 8px; min-height: 58px; padding: 14px 10px 4px; border-bottom: 1px solid var(--pianif-border-soft); touch-action: none; user-select: none; -webkit-user-select: none;
  }
  .planner-mobile-sheet-grip { position: absolute; top: 0; left: 0; right: 0; height: 16px; cursor: ns-resize; touch-action: none; }
  .planner-mobile-sheet-grip::before { content: ""; position: absolute; top: 5px; left: calc(50% - 18px); width: 36px; height: 4px; background: var(--pianif-border-strong); border-radius: 3px; }
  .planner-mobile-sheet-grip:focus-visible { outline: 2px solid var(--pianif-sage-300); outline-offset: -2px; }
  .planner-mobile-sheet-heading { flex: 1; min-width: 0; }
  .pianification-layout-shell[data-mobile-panel="patterns"] #left-sidebar .planner-mobile-sheet-header .pianification-left-filter-row { display: none; }
  #left-sidebar .planner-mobile-sheet-header .pianification-left-filter-row {
    display: flex; align-items: center; flex: 0 1 auto; gap: 5px; min-width: 0; margin: 0;
  }
  #left-sidebar .planner-mobile-sheet-header .pianification-left-filter-row > * { width: auto; }
  #left-sidebar .planner-mobile-sheet-header .plant-type-dropdown { flex: 0 0 auto; min-width: max-content; }
  #left-sidebar .planner-mobile-sheet-header .pianification-left-filter-row :is(.plant-type-dropdown-toggle, #period-filter-btn) {
    box-sizing: border-box; height: 36px !important; min-height: 36px; min-block-size: 36px;
    padding: 3px 6px; gap: 4px; font-size: 11px;
  }
  #left-sidebar .planner-mobile-sheet-header #period-filter-btn { flex: 0 1 auto; }
  html[data-app-planner-landscape] [data-mobile-catalog-narrow="true"] #left-sidebar .planner-mobile-sheet-header .plant-type-dropdown {
    flex: 0 1 auto; min-width: 48px;
  }
  html[data-app-planner-landscape] [data-mobile-catalog-narrow="true"] #left-sidebar .planner-mobile-sheet-header #period-filter-btn {
    flex: 0 0 auto; max-width: 82px; padding-inline: 4px;
  }
  html[data-app-planner-landscape] [data-mobile-catalog-narrow="true"] #left-sidebar .planner-mobile-sheet-header #period-filter-btn svg {
    display: none;
  }
  html[data-app-planner-landscape] [data-mobile-catalog-narrow="true"][data-mobile-panel="plants"] #left-sidebar .planner-mobile-sheet-header h2 {
    overflow: hidden; text-overflow: ellipsis;
  }
  .planner-mobile-sheet-header :is(.pianification-right-section-heading, .sheet-header) { width: 100%; margin: 0 !important; padding: 0 !important; border: 0; background: transparent; }
  .planner-mobile-sheet-header .pianification-right-section-heading { display: flex; align-items: center; gap: 6px; }
  .planner-mobile-sheet-header :is(.pianification-right-section-title, .sheet-title) { font-size: 15px; }
  .planner-mobile-sheet-header .sheet-title-row { flex-wrap: wrap; gap: 5px; }
  .planner-mobile-sheet-header .sheet-counts { margin: 3px 0 0; padding: 0; }
  .planner-mobile-sheet-header .sheet-year-select { font-size: 12px; max-width: 75px; }
  .pianification-layout-shell .pianification-right-section:has(> .planner-mobile-sheet-header) { padding-top: 0; }
  .planner-mobile-sheet-header h2 { margin: 0; font-size: 16px; font-weight: 650; }
  .planner-mobile-sheet-header button { flex: 0 0 auto; min-height: 44px; padding: 5px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--pianif-sage-300); font-size: 12px; }
  .planner-mobile-sheet-header .sheet-year-toggle { height: 30px; min-height: 30px; padding: 3px 7px; border: 1px solid var(--pianif-border-soft); background: var(--pianif-surface-1); color: var(--pianif-text-strong); }
  .planner-mobile-sheet-header .sheet-year-options button { color: var(--pianif-text-strong); }
  .planner-mobile-sheet-header > [data-mobile-action="collapse"] { width: 40px; min-width: 40px; padding: 8px; }
  .planner-mobile-sheet-header > [data-mobile-action="collapse"] svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .planner-mobile-sheet-title[hidden], .planner-mobile-sheet-header h2[hidden] { display: none !important; }
  .planner-mobile-sheet-header .pianification-section-create-btn { min-width: 40px; padding: 4px; font-size: 22px; }
  .pianification-task-complete-toggle { position: relative; flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent !important; }
  .pianification-task-complete-toggle::before { content: ""; position: absolute; inset: 13px; border: 2px solid var(--task-accent, var(--pianif-sage-300)); border-radius: 50%; }
  .pianification-task-complete-toggle.checked::before { background: var(--task-accent, var(--pianif-sage-300)); }
  .pianification-task-complete-toggle.checked::after { inset: 16px; }
  .pianification-layout-shell[data-mobile-accessory-peek="true"] #pianification-right-accessories-section { padding: 0 !important; }
  .pianification-layout-shell[data-mobile-accessory-peek="true"] #pianification-right-accessories-section > :not(.planner-mobile-sheet-header) { display: none !important; }
  .pianification-layout-shell[data-mobile-accessory-peek="true"] #pianification-right-sidebar .planner-mobile-sheet-header { min-height: 92px; padding-bottom: 28px; }
  .pianification-layout-shell[data-mobile-accessory-peek="true"] #pianification-right-sidebar .planner-mobile-sheet-header::after { content: attr(data-drawing-hint); position: absolute; bottom: 8px; left: 12px; right: 12px; font-size: 11px; color: var(--pianif-text-muted); }
  .automatic-leave-dialog button { min-height: 44px; }
  .planner-mobile-sheet-footer { display: flex; flex: 0 0 auto; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 12px; border-top: 1px solid var(--pianif-border-soft); }
  #left-sidebar .planner-mobile-sheet-footer { padding-block: 4px; }
  .planner-mobile-sheet-footer [hidden] { display: none; }
  .planner-mobile-sheet-footer span { flex: 1; min-width: 0; font-size: 12px; line-height: 1.35; color: var(--pianif-text-muted); }
  .planner-mobile-sheet-footer button { flex: 0 0 auto; min-height: 44px; }
  .planner-mobile-sheet-footer button:disabled { opacity: .45; }
  .planner-mobile-tools-body { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 12px; overscroll-behavior: contain; }
  .planner-mobile-tools-body p { margin: 0 0 12px; color: var(--pianif-text-muted); font-size: 13px; }
  .planner-mobile-tools-body button { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 46px; padding: 10px 12px; margin-bottom: 7px; border: 1px solid var(--pianif-border-soft); border-radius: 8px; color: var(--pianif-text); background: var(--pianif-surface-2); text-align: left; font-size: 14px; }
  .planner-mobile-tools-body button[aria-pressed="true"] { border-color: var(--pianif-sage-300); background: var(--pianif-active); }
  .planner-mobile-tools-body button:disabled { opacity: .5; }
  .planner-mobile-tools-body svg { flex: 0 0 22px; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
  .planner-mobile-tools-body small { display: block; color: var(--pianif-text-muted); font-size: 12px; }
  .planner-mobile-bed-list { margin-top: 16px; }
  .planner-bed-area-meter { display: none !important; }
  body.planner-bed-resizing .planner-bed-area-meter:not([hidden]) { display: block !important; }
  .planner-mobile-tools-title-group { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
  .planner-mobile-bed-area-usage { color: var(--pianif-text-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .planner-mobile-bed-area-usage.is-limit { color: var(--pianif-danger); }
  .pianification-layout-shell:not([data-mobile-panel="beds"]) .planner-mobile-bed-area-usage { display: none; }
  .planner-mobile-bed-list button { justify-content: space-between; }
  .planner-mobile-primary { padding: 8px 12px; border: 1px solid transparent !important; border-radius: 8px; background: var(--pianif-sage-500) !important; color: #fff !important; font-weight: 600; }
  .planner-mobile-outline { padding: 8px 12px; border: 1px solid var(--pianif-sage-300); border-radius: 8px; background: transparent; color: var(--pianif-sage-300); font-weight: 600; }

  .planner-mobile-view-tools { position: absolute; z-index: 210; top: var(--mobile-header-bottom, 112px); right: max(8px, env(safe-area-inset-right)); flex-direction: column; gap: 4px; }
  .planner-mobile-view-tools button { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; border: 1px solid var(--pianif-border-soft); border-radius: 10px; background: var(--pianif-surface-1); color: var(--pianif-text); font-size: 24px; line-height: 1; box-shadow: var(--pianif-shadow-sm); }
  .planner-mobile-view-tools button:disabled { opacity: .45; }
  .planner-mobile-view-tools svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .planner-mobile-workbar { position: absolute; z-index: 230; bottom: calc(var(--mobile-dock-height) + 8px); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--pianif-border-soft); border-radius: 12px; background: var(--pianif-surface-1); color: var(--pianif-text); box-shadow: var(--pianif-shadow-md); }
  .planner-mobile-workbar-summary { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .planner-mobile-workbar-summary > div { flex: 1; min-width: 0; }
  .planner-mobile-workbar-summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .planner-mobile-workbar-summary strong[hidden] { display: none; }
  .planner-mobile-workbar-summary span { display: block; color: var(--pianif-text-muted); font-size: 11px; line-height: 1.4; margin-top: 2px; }
  .planner-mobile-workbar-summary strong[hidden] + span { margin-top: 0; }
  .planner-mobile-workbar-summary button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--pianif-text-muted); font-size: 25px; }
  .planner-mobile-workbar-summary .planner-mobile-bed-edit { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; min-height: 32px; min-block-size: 32px; color: var(--pianif-sage-300); }
  .planner-mobile-workbar-summary .planner-mobile-bed-edit[hidden] { display: none; }
  .planner-mobile-bed-edit svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .planner-mobile-modes { display: flex; gap: 4px; }
  .planner-mobile-modes[hidden] { display: none; }
  .planner-mobile-modes button { flex: 1; min-width: 0; min-height: 44px; padding: 5px 4px; border: 1px solid var(--pianif-border-soft); border-radius: 7px; color: var(--pianif-text); background: var(--pianif-surface-2); font-size: 11px; }
  .planner-mobile-modes button[aria-pressed="true"] { color: var(--pianif-sage-300); background: var(--pianif-active); border-color: var(--pianif-sage-500); }
  .planner-mobile-modes button:disabled { opacity: .4; }
  .planner-mobile-confirm { display: flex; gap: 8px; }
  .planner-mobile-confirm[hidden] { display: none; }
  .planner-mobile-confirm button { flex: 1; min-height: 44px; border: 1px solid var(--pianif-border-soft); border-radius: 8px; color: var(--pianif-text); background: var(--pianif-surface-2); font-size: 13px; }
  .pianification-layout-shell:not([data-mobile-panel="none"]) .planner-mobile-workbar { display: none !important; }
  /* Prevent iOS from zooming the page when a field receives focus. */
  .pianification-scope :is(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), select:not(.sheet-year-select), textarea) { font-size: 16px !important; }
  .pianification-scope :is(button, summary, .form-check-label) { -webkit-tap-highlight-color: transparent; }
  .pianification-right-section :is(button, summary), .pattern-selector-overlay button, .planner-bed-builder button { min-height: 44px; }
  .pianification-right-section .plant-info-relation-group > summary { min-height: 0; padding: 4px 0; margin-bottom: 4px; }
  .pianification-right-section .plant-info-relation-item { box-sizing: border-box; min-height: 30px; }
  .pianification-right-section .plant-info-relations-more { min-height: 30px; height: 30px; padding: 4px 7px; }
  #gardenTabsContent .planner-note-title-input { font-size: calc(14px * var(--planner-note-ui-scale)) !important; }
  #gardenTabsContent .planner-mobile-note-editing .planner-note-title-input { font-size: 16px !important; }
  .planner-note.planner-mobile-note-editing:popover-open {
    position: fixed; inset: auto; top: var(--mobile-note-top) !important; left: var(--mobile-note-left) !important; margin: 0;
    width: var(--mobile-note-width) !important; height: var(--mobile-note-height) !important; max-height: none !important;
    display: flex; overflow: hidden; --planner-note-ui-scale: 1 !important;
  }
  .planner-mobile-note-editing::backdrop { background: transparent; pointer-events: none; }
  .planner-mobile-note-editing .planner-note-header { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 8px; min-height: 48px; padding: 8px 10px; cursor: default; }
  .planner-mobile-note-editing .planner-note-title-input { grid-column: 1; width: 100% !important; min-height: 32px; }
  .planner-mobile-note-editing .planner-note-header-actions { grid-column: 1 / -1; width: 100%; max-width: none; display: flex !important; justify-content: flex-end; gap: 4px; margin: 0; opacity: 1; visibility: visible; }
  .planner-mobile-note-editing .planner-note-format-tools { display: flex; gap: 4px; }
  .planner-mobile-note-editing :is(.planner-note-header-actions button, .planner-note-color-input, .planner-note-text-color-control) { width: 40px; height: 40px; flex: 0 0 40px; }
  .planner-mobile-note-editing .planner-note-text-size-select { width: 44px; min-width: 44px; height: 40px; }
  .planner-mobile-note-editing .planner-note-header-actions svg { width: 18px; height: 18px; }
  .planner-mobile-note-editing .planner-note-format-glyph { font-size: 16px; }
  .planner-mobile-note-editing :is(.planner-note-drag-handle, .planner-note-created-at, [class*="planner-note-resize-"]) { display: none; }
  .planner-mobile-note-editing :is(.planner-note-title-input, .planner-note-text) { font-size: 16px !important; line-height: 1.4 !important; }
  .planner-mobile-note-editing .planner-note-text { overflow-y: auto; padding: 10px; touch-action: pan-y; }
  .planner-mobile-note-editing .planner-mobile-note-done { display: block; position: absolute; top: 4px; right: 6px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: #24180a; font-size: 14px; }
  body.planner-mobile-note-writing :is(.pianification-center-header, .planner-mobile-workbar, .planner-mobile-view-tools) { visibility: hidden !important; }
  .planner-bed-builder { max-height: calc(100dvh - 24px); overflow-y: auto; }
  .pattern-selector-overlay {
    inset: var(--planner-mobile-viewport-top, 0px) auto auto var(--planner-mobile-viewport-left, 0px);
    width: var(--planner-mobile-viewport-width, 100vw); height: var(--planner-mobile-viewport-height, 100dvh);
    padding: 4px; align-items: stretch;
  }
  .pattern-workspace-dialog.pattern-selector { width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 12px; }
  .pattern-workspace-dialog .pattern-selector-header { padding: 6px 10px; gap: 8px; }
  .pattern-workspace-dialog .pattern-selector-header > div { min-width: 0; }
  .pattern-workspace-dialog h2 { font-size: 16px; }
  .pattern-selector-columns { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, .58fr) minmax(0, .42fr); }
  .pattern-selector-catalog { min-height: 0; }
  .pattern-workspace-dialog .pattern-selected-plants { min-height: 36px; padding-block: 4px; }
  .pattern-workspace-dialog .pattern-selected-plants:empty { display: none; }
  .pattern-workspace-dialog .pattern-selector-list { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 4px; padding-bottom: 6px; }
  .pattern-workspace-dialog .pattern-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-planner-pattern-writing="true"] .pattern-selector-columns { grid-template-rows: minmax(0, 1fr); }
  body[data-planner-pattern-writing="true"] .pattern-selector-recommendations { display: none; }
  body[data-planner-pattern-writing="true"] .pattern-selector-header p { display: none; }
  body[data-planner-pattern-writing="true"] .pattern-selector-header { padding-block: 0; }
  body[data-planner-pattern-writing="true"] .pattern-selected-plants:not(:has(.pattern-plant-icon)) { display: none; }
  body[data-planner-pattern-writing="true"] .pattern-selector-catalog { padding-top: 4px; }
  .pp-context-menu { box-sizing: border-box; width: max-content; min-width: 0; max-width: min(248px, calc(100vw - 16px)); max-height: min(400px, 70dvh, calc(var(--planner-mobile-viewport-height, 100dvh) - 16px)); overflow-y: auto; grid-template-columns: minmax(0, 1fr); gap: 0; padding: 4px; border-color: var(--pianif-border-strong); border-radius: 10px; background: var(--pianif-surface-card); color: var(--pianif-text); box-shadow: var(--pianif-shadow-md); touch-action: pan-y; }
  .pp-context-menu .item { box-sizing: border-box; min-height: 34px; min-block-size: 34px; padding: 7px 9px; gap: 8px; border-radius: 5px; font-size: 13px; line-height: 1.25; white-space: normal; }
  .pp-context-menu .item svg { flex: 0 0 16px; width: 16px; height: 16px; }
  .pp-context-menu .item:is(:hover, :focus-visible) { background: var(--pianif-surface-2); }
  .pp-context-menu .sep { height: 1px; margin: 3px 5px; background: var(--pianif-border-soft); }
  .sidebar-compact-fill-conflict-popup { max-width: calc(100vw - 16px); max-height: 65dvh; overflow-y: auto; }
  .sidebar-compact-fill-conflict-popup button { min-height: 44px; }
  .block-alt-resize-conflict-popup { flex-wrap: wrap; touch-action: manipulation; }
  .block-alt-resize-conflict-popup > span { flex: 1 0 100%; line-height: 1.4; }
  .block-alt-resize-conflict-popup > button { flex: 1 0 auto; white-space: nowrap; }
  .planner-offline-sync-status { bottom: calc(66px + env(safe-area-inset-bottom) + 150px); }
}

@media (max-width: 360px), (max-width: 700px) and (max-height: 700px) {
  .pianification-layout-shell[data-mobile-compact="true"] .planner-mobile-sheet-header { min-height: 52px; padding-top: 8px; }
  .pattern-workspace-dialog .pattern-selector-header p { display: none; }
  .pattern-workspace-dialog :is(.pattern-selector-catalog, .pattern-selector-recommendations) { padding-inline: 8px; }
}

@media (max-width: 370px) {
  #planner-mobile-dock [data-mobile-panel="patterns"] { font-size: 10px; }
}

@media (max-height: 520px) and (max-width: 1100px) {
  .pianification-layout-shell { --mobile-dock-height: calc(55px + env(safe-area-inset-bottom, 0px)); }
  .pianification-center-header { flex-wrap: nowrap; gap: 8px; }
  .pianification-center-header-week { flex: 1; }
  .pianification-center-header-week .pianification-today-btn { position: static; }
  .planner-mobile-view-tools { flex-direction: row; }
  .planner-mobile-view-tools button { width: 40px; height: 40px; }
  .planner-mobile-workbar { left: 8px; right: auto; width: min(430px, calc(100% - 16px)); padding: 6px 8px; gap: 3px; }
  .planner-mobile-workbar-summary span { display: none; }
  .pianification-layout-shell :is(#left-sidebar, #pianification-right-sidebar, .planner-mobile-sheet) { height: var(--mobile-sheet-height, calc(100% - var(--mobile-dock-height) - 24px)); }
  .pianif-sun-body { grid-template-columns: minmax(140px, .9fr) minmax(180px, 1fr); align-items: start; gap: 16px; padding: 12px 20px; }
  .pianif-sun-preview { width: min(200px, 100%); margin: 0 auto; }
  .pianif-sun-hint { margin: 6px 0 0; font-size: 11px; }
  .pianif-sun-time-head { margin: 6px 0; }
}
