/* R693: mobile filter sheets must not inherit the V3 control's 42px height.
   The blurred control deck was also trapping fixed sheets below status cards. */
@media (max-width: 760px) {
  .dashboard-page .dashboard-control-deck,
  .dashboard-page .dashboard-v2-control-deck {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: auto;
  }
  .dashboard-page .dashboard-filters .dashboard-filter-column {
    min-height: 0;
    height: auto;
    padding: 12px;
  }
  .dashboard-page .dashboard-filters .dashboard-v3-branch-inner {
    border: 0;
    padding: 0;
  }
  .dashboard-page .dashboard-filters .dashboard-filter-grid { gap: 10px; }
  .dashboard-page .dashboard-filters .dashboard-filter-column-period { gap: 10px; }
  .dashboard-page .dashboard-filters .dashboard-filter-footer {
    width: 100%;
    justify-self: stretch;
  }
  .dashboard-page .dashboard-filters .dashboard-apply {
    width: 100%;
    min-height: 46px;
  }
  .dashboard-page .dashboard-filters .dashboard-custom-dates input,
  .dashboard-page .dashboard-option-field select { font-size: 16px; min-height: 44px; }
  .dashboard-page .dashboard-combobox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 42, .46);
    touch-action: none;
  }
  .dashboard-page .dashboard-filters .dashboard-option-combobox.is-open,
  .dashboard-page .dashboard-filters .dashboard-branch-combobox.is-open,
  .dashboard-page .dashboard-v2-filters .dashboard-option-combobox.is-open,
  .dashboard-page .dashboard-v2-filters .dashboard-branch-combobox.is-open {
    position: fixed;
    z-index: 1201;
    top: max(12px, env(safe-area-inset-top));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    width: auto;
    height: auto;
    min-height: 0;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-rows: 48px minmax(0, 1fr);
    align-content: stretch;
    gap: 8px 4px;
    padding: 12px;
    overflow: hidden;
    border: 1px solid #d4deed;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 64px rgba(15, 23, 42, .24);
  }
  .dashboard-page .dashboard-filters .is-open .dashboard-option-options,
  .dashboard-page .dashboard-filters .is-open .dashboard-branch-options,
  .dashboard-page .dashboard-v2-filters .is-open .dashboard-option-options,
  .dashboard-page .dashboard-v2-filters .is-open .dashboard-branch-options {
    position: static;
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 0;
    max-height: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 8px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 0;
    border-top: 1px solid #e2e8f0;
    border-radius: 0;
    box-shadow: none;
    touch-action: pan-y;
  }
  .dashboard-page .is-open .dashboard-option-options button,
  .dashboard-page .is-open .dashboard-branch-options button {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 12px;
    font-size: 16px;
    line-height: 1.4;
    touch-action: manipulation;
  }
  .dashboard-page .is-open [role=option][aria-selected=true] {
    background: #eaf2ff;
    color: #1457a6;
    font-weight: 700;
  }
  .dashboard-page .is-open [role=option] span { white-space: normal; overflow-wrap: anywhere; }
  .dashboard-page .dashboard-filters .is-open input,
  .dashboard-page .dashboard-v2-filters .is-open input {
    min-width: 0;
    min-height: 44px;
    height: 44px;
    font-size: 16px;
  }
  .dashboard-page .is-open .dashboard-option-toggle,
  .dashboard-page .is-open .dashboard-branch-toggle {
    width: auto;
    min-width: 70px;
    height: 44px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #eaf2ff;
    color: #1457a6;
    font-size: 14px;
    font-weight: 700;
  }
  .dashboard-page .is-open .dashboard-option-toggle svg,
  .dashboard-page .is-open .dashboard-branch-toggle svg { display: none; }
  .dashboard-page .is-open .dashboard-option-toggle::after,
  .dashboard-page .is-open .dashboard-branch-toggle::after { content: "Готово"; }
  .dashboard-page .is-open .dashboard-option-clear { width: 44px; height: 44px; }
  body:has(.dashboard-page .dashboard-option-combobox.is-open),
  body:has(.dashboard-page .dashboard-branch-combobox.is-open) { overflow: hidden; }
  .dashboard-page .dashboard-segmented { min-height: 44px; height: auto; flex-wrap: wrap; }
  .dashboard-page .dashboard-segmented button { min-height: 40px; height: auto; font-size: 13px; padding: 8px; }
  .dashboard-page .legacy-analytics-mode-controls { grid-template-columns: minmax(0,1fr); gap: 8px; }
}
@media (max-width: 760px) and (max-height: 500px) {
  .dashboard-page .dashboard-filters .dashboard-option-combobox.is-open,
  .dashboard-page .dashboard-filters .dashboard-branch-combobox.is-open {
    top: 6px;
    bottom: 6px;
    max-height: calc(100dvh - 12px);
    padding: 6px 12px;
  }
}
