/* Mobile UI v8 — visual-review refinement pass. */
@media (max-width: 760px) {
  /* Bottom nav: one icon + one label, four stable equal-width destinations. */
  .topbar > nav {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-template-rows: 56px !important;
    height: calc(62px + env(safe-area-inset-bottom)) !important;
    padding: 3px 6px env(safe-area-inset-bottom) !important;
    background: #0f3554 !important;
    border-top: 1px solid rgba(255,255,255,.13) !important;
    box-shadow: 0 -5px 18px rgba(8,28,46,.18) !important;
    overflow: visible !important;
  }
  .topbar > nav > a {
    min-width: 0 !important;
    width: auto !important;
    height: 56px !important;
    margin: 0 2px !important;
  }
  .topbar > nav > a:nth-of-type(1) { grid-column: 1 !important; grid-row: 1 !important; }
  .topbar > nav > a:nth-of-type(2) { grid-column: 2 !important; grid-row: 1 !important; }
  .topbar > nav > a:nth-of-type(3) { grid-column: 3 !important; grid-row: 1 !important; }
  .topbar > nav > a {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    padding: 5px 3px 4px !important;
    border-radius: 11px !important;
    color: #a9bfce !important;
    font-size: 10.5px !important;
    line-height: 1 !important;
  }
  .topbar > nav > a > span {
    width: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    display: block !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: inherit !important;
    line-height: 1.1 !important;
  }
  .topbar > nav > a > span::before { display: none !important; content: none !important; }
  .topbar > nav > a::before {
    width: 19px !important;
    height: 19px !important;
    margin: 0 !important;
    flex: 0 0 19px !important;
  }
  .topbar > nav > a.active,
  .topbar > nav > a[aria-current="page"] {
    background: #1e7fbd !important;
    color: #fff !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.15) inset !important;
  }

  /* Cases attention badge sits on the upper-right of the Cases icon. */
  .topbar > nav > a.nav-open-issues {
    position: relative !important;
  }
  .topbar > nav > a.nav-open-issues .nav-attention-badge {
    position: absolute !important;
    top: 5px !important;
    left: calc(50% + 5px) !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: none !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 0 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    line-height: 18px !important;
    font-size: 9px !important;
    z-index: 3 !important;
  }

  /* More is the actual fourth grid item. Reset older desktop/mobile rules
     instead of layering a second fixed hit target over the nav. */
  .topbar > nav > details.nav-more {
    grid-column: 4 !important;
    grid-row: 1 !important;
    position: relative !important;
    right: auto !important;
    left: auto !important;
    top: auto !important;
    bottom: auto !important;
    z-index: 102 !important;
    width: auto !important;
    min-width: 0 !important;
    height: 56px !important;
    min-height: 56px !important;
    margin: 0 2px !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 11px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #a9bfce !important;
  }
  .topbar > nav > details.nav-more > summary {
    box-sizing: border-box !important;
    width: 100% !important;
    height: 56px !important;
    min-height: 56px !important;
    margin: 0 !important;
    padding: 5px 3px 4px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    border: 0 !important;
    border-radius: 11px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: inherit !important;
    font-size: 10.5px !important;
    line-height: 1 !important;
    list-style: none !important;
    cursor: pointer !important;
  }
  .topbar > nav > details.nav-more > summary::-webkit-details-marker { display: none !important; }
  .topbar > nav > details.nav-more > summary::marker { content: '' !important; }
  .topbar > nav > details.nav-more > summary::before {
    width: 19px !important;
    height: 19px !important;
    margin: 0 !important;
    flex: 0 0 19px !important;
  }
  .topbar > nav > details.nav-more > summary::after { content: none !important; display: none !important; }
  .topbar > nav > details.nav-more > summary > span { display: none !important; }
  .topbar > nav > details.nav-more[open] > summary {
    background: #1e7fbd !important;
    color: #fff !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.15) inset !important;
  }
  .topbar > nav > details.nav-more > div {
    position: fixed !important;
    right: 8px !important;
    left: 8px !important;
    bottom: calc(68px + env(safe-area-inset-bottom)) !important;
    z-index: 103 !important;
    width: auto !important;
    max-height: min(70vh, 520px) !important;
    overflow-y: auto !important;
  }

  /* Sites: collapse the filter card into a light command strip. */
  .full-bleed > .welcome-time { margin: 6px 10px 4px !important; padding: 7px 10px !important; }
  .full-bleed > .welcome-time + .filter-bar {
    margin: 4px 10px 5px !important;
    padding: 5px 7px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .full-bleed > .welcome-time + .filter-bar .filter-bar-fields { gap: 3px !important; }
  .full-bleed > .welcome-time + .filter-bar label { font-size: 10px !important; }
  .full-bleed > .welcome-time + .filter-bar select {
    min-height: 34px !important;
    height: 34px !important;
    padding: 4px 8px !important;
    font-size: 12px !important;
    background: #fff !important;
  }
  .full-bleed > .welcome-time + .filter-bar .filter-bar-footer {
    min-height: 18px !important;
    margin-top: 1px !important;
  }
  .full-bleed > .welcome-time + .filter-bar .filter-result-text {
    font-size: 10px !important;
    font-weight: 650 !important;
  }
  .site-card { margin-bottom: 6px !important; }
  .site-card-main { min-height: 72px !important; grid-template-columns: 72px minmax(0,1fr) !important; }
  .site-card-main > img,
  .site-card-main > .thumbnail,
  .site-card-main > .thumb-placeholder { width: 72px !important; height: 72px !important; min-width: 72px !important; }
  .site-card-footer { padding: 7px 9px !important; }
  .site-card-title { font-size: 14px !important; }
  .site-card-photo-time { font-size: 10px !important; }

  /* Rounds: preserve density but restore readable report hierarchy. */
  .rounds-dashboard .ai-report-card,
  .ai-report-list .ai-report-card,
  .round-report-list .round-report-card {
    font-size: 11.5px !important;
    line-height: 1.34 !important;
  }
  .ai-report-card strong,
  .round-report-card strong { font-size: 12.5px !important; line-height: 1.25 !important; }
  .ai-report-card .muted,
  .round-report-card .muted { font-size: 10px !important; line-height: 1.3 !important; }
  .ai-report-card button,
  .ai-report-card .button-link,
  .round-report-card button,
  .round-report-card .button-link { font-size: 10px !important; min-height: 34px !important; }

  /* Cases: compact, but readable without pinch-zoom. */
  .open-issues-page { font-size: 11.5px !important; }
  .open-issues-page .ui-page-header-row h2 { font-size: 23px !important; }
  .open-issues-page .ui-page-header-row p.muted { font-size: 10.5px !important; line-height: 1.3 !important; }
  .open-issue-card { min-height: 56px !important; padding: 8px 9px !important; }
  .open-issue-card strong { font-size: 12px !important; }
  .open-issue-card p { font-size: 10px !important; line-height: 1.3 !important; }
  .open-ai-cases-heading h3 { font-size: 14.5px !important; line-height: 1.2 !important; }
  .open-ai-cases-heading p { font-size: 10.5px !important; line-height: 1.3 !important; }
  .open-ai-case { padding: 10px !important; }
  .open-ai-case-top strong { font-size: 12px !important; line-height: 1.32 !important; }
  .open-ai-case-top .ai-status { font-size: 9px !important; }
  .open-ai-case > p,
  .open-ai-case details,
  .open-ai-case .motion-maintenance-facts { font-size: 10.5px !important; line-height: 1.38 !important; }
  .open-ai-case .muted { font-size: 10px !important; line-height: 1.32 !important; }
  .open-ai-case .ai-monitoring-note { padding: 6px 7px !important; font-size: 10.5px !important; }
  .open-ai-case .form-inline button,
  .open-ai-case .form-inline .button-link { min-height: 35px !important; padding: 6px 8px !important; font-size: 10px !important; }
}
