/* Mobile breakpoints — app-shell web UI (search, briefing, saved, catches) */

/* ── Search: stacked map + panel ─────────────────────────────────────────── */
@media (max-width: 900px) {
  html[data-layout="app-shell"] .search-wizard-steps {
    margin: 14px 14px 0;
    padding: 3px;
  }

  html[data-layout="app-shell"] .search-wizard-scroll {
    padding: 14px 14px 8px;
  }

  html[data-layout="app-shell"] .search-wizard-footer {
    padding: 12px 14px 16px;
  }

  html[data-layout="app-shell"] .search-step-title {
    font-size: 1.15rem;
  }

  html[data-layout="app-shell"] .search-results-wrap {
    padding: 16px 14px 24px;
  }

  html[data-layout="app-shell"] .app-view--search:not(.search-idle) .search-results-wrap {
    padding: 14px 14px 28px;
  }

  /* Briefing: give results more room; keep a compact map strip */
  html[data-layout="app-shell"] .app-view--search:not(.search-idle) .search-stage {
    grid-template-rows: minmax(140px, 26vh) minmax(0, 1fr);
  }

  html[data-layout="app-shell"] .app-view--search:not(.search-idle) .search-map-layer {
    min-height: 140px;
  }

  html[data-layout="app-shell"] .app-view--search:not(.search-idle) .search-map-layer #map,
  html[data-layout="app-shell"] .app-view--search:not(.search-idle) .search-map-layer .leaflet-container {
    min-height: 140px !important;
  }

  html[data-layout="app-shell"] .search-side-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
  }

  html[data-layout="app-shell"] .app-view--search:not(.search-idle) .search-results-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  html[data-layout="app-shell"] .search-map-layer .map-overlay {
    padding: 16px 12px 20px;
    font-size: 0.8rem;
  }

  html[data-layout="app-shell"] .water-type-override {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
  }

  html[data-layout="app-shell"] .water-type-override label {
    margin: 0;
  }

  html[data-layout="app-shell"] .app-view--saved {
    padding: 16px 14px 32px;
  }

  html[data-layout="app-shell"] .catches-panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  html[data-layout="app-shell"] .catches-panel-head-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  html[data-layout="app-shell"] .catches-panel-head-tabs::-webkit-scrollbar {
    display: none;
  }

  html[data-layout="app-shell"] .briefing-dash-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  html[data-layout="app-shell"] .briefing-dash-title {
    font-size: 1.2rem;
  }
}

/* ── Phone: wizard, filters, touch targets ─────────────────────────────────── */
@media (max-width: 640px) {
  html[data-layout="app-shell"] .search-wizard-step {
    font-size: 0.74rem;
    gap: 4px;
  }

  html[data-layout="app-shell"] .search-wizard-step-num {
    width: 22px;
    height: 22px;
    font-size: 0.72rem;
  }

  html[data-layout="app-shell"] .search-wizard-btn {
    min-height: 44px;
    padding: 12px 14px;
  }

  html[data-layout="app-shell"] .search-wizard-footer .btn-analyze {
    min-height: 48px;
  }

  html[data-layout="app-shell"] .btn-locate {
    min-height: 48px;
  }

  html[data-layout="app-shell"] .search-map-control-btn {
    width: 44px;
    height: 44px;
  }

  html[data-layout="app-shell"] .location-search-input-row .btn-zip-go {
    min-height: 44px;
    padding: 0 14px;
  }

  html[data-layout="app-shell"] .search-plan-card {
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
  }

  html[data-layout="app-shell"] .search-plan-quota {
    font-size: 0.82rem;
  }

  /* Saved searches header */
  html[data-layout="app-shell"] .saved-view-header-top {
    flex-direction: column;
    align-items: stretch;
  }

  html[data-layout="app-shell"] .saved-search-filter-wrap {
    max-width: none;
    width: 100%;
    margin-left: 0;
  }

  html[data-layout="app-shell"] .saved-view-header h2 {
    font-size: 1.35rem;
  }

  /* Saved table → cards */
  html[data-layout="app-shell"] .saved-table thead {
    display: none;
  }

  html[data-layout="app-shell"] .saved-table tbody tr.saved-item {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-areas:
      "thumb loc"
      "thumb species"
      "thumb date"
      "thumb conditions"
      "actions actions";
    gap: 4px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  }

  html[data-layout="app-shell"] .saved-table tbody tr.saved-item:hover {
    background: rgba(37, 99, 235, 0.04);
  }

  html[data-layout="app-shell"] .saved-table tbody td {
    display: block;
    padding: 0;
    border: none;
  }

  html[data-layout="app-shell"] .saved-table-thumb-cell {
    grid-area: thumb;
    align-self: start;
  }

  html[data-layout="app-shell"] .saved-table tbody td:nth-child(2) {
    grid-area: loc;
  }

  html[data-layout="app-shell"] .saved-table tbody td:nth-child(3) {
    grid-area: species;
  }

  html[data-layout="app-shell"] .saved-table tbody td:nth-child(4) {
    grid-area: date;
  }

  html[data-layout="app-shell"] .saved-table tbody td:nth-child(5) {
    grid-area: conditions;
  }

  html[data-layout="app-shell"] .saved-table tbody td:nth-child(6) {
    grid-area: actions;
    padding-top: 10px;
    margin-top: 4px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
  }

  html[data-layout="app-shell"] .saved-table-actions {
    justify-content: flex-start;
    gap: 10px;
  }

  html[data-layout="app-shell"] .saved-icon-btn {
    width: 44px;
    height: 44px;
  }

  html[data-layout="app-shell"] .saved-table-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    text-align: center;
  }

  html[data-layout="app-shell"] .saved-table-pager {
    justify-content: center;
  }

  html[data-layout="app-shell"] .saved-pager-btn {
    width: 36px;
    height: 36px;
  }

  /* Catches filters */
  html[data-layout="app-shell"] .catches-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  html[data-layout="app-shell"] .catches-filter-field {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }

  html[data-layout="app-shell"] .catches-filter-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  html[data-layout="app-shell"] .catches-panel-title {
    font-size: 1.35rem;
  }

  html[data-layout="app-shell"] .catches-panel-toolbar {
    padding: 14px 0;
    margin-bottom: 12px;
  }

  html[data-layout="app-shell"] .catches-panel {
    padding: 0 0 20px;
  }

  html[data-layout="app-shell"] .catches-pager {
    flex-wrap: wrap;
    justify-content: center;
  }

  html[data-layout="app-shell"] .catches-btn {
    min-height: 44px;
  }

  /* Briefing dashboard */
  html[data-layout="app-shell"] .briefing-tackle-strip {
    flex-wrap: wrap;
    gap: 8px;
  }

  html[data-layout="app-shell"] .briefing-acc-summary {
    padding: 12px 14px;
    font-size: 0.88rem;
  }

  html[data-layout="app-shell"] .briefing-action-btn {
    min-height: 44px;
  }
}

@media (max-width: 560px) {
  html[data-layout="app-shell"] .search-stage {
    grid-template-rows: minmax(220px, 38vh) minmax(0, 1fr);
  }
}

@media (max-width: 380px) {
  html[data-layout="app-shell"] .search-wizard-step {
    font-size: 0;
    gap: 0;
    justify-content: center;
    flex: 1 1 0;
  }

  html[data-layout="app-shell"] .search-wizard-step.is-active {
    padding: 4px 8px 4px 4px;
    font-size: 0;
  }

  html[data-layout="app-shell"] .search-wizard-step-num {
    font-size: 0.78rem;
  }

  html[data-layout="app-shell"] .header-nav-tab.ff-pill-tab {
    padding: 7px 9px;
    font-size: 0.72rem;
  }
}

@supports (padding: max(0px)) {
  html[data-layout="app-shell"] .search-wizard-footer,
  html[data-layout="app-shell"] .catches-screen-main,
  html[data-layout="app-shell"] .app-view--saved {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}
