/* Shares the existing CRM colors, spacing and controls. The top bar holds the
   business search and the public web link; it exists only for businesses with
   the commercial CRM or the vehicle stock. */
.app-shell.has-global-search { grid-template-rows: var(--topbar-h) minmax(0,1fr); }
.app-shell.has-global-search > .rail { grid-column: 1; grid-row: 1 / span 2; }
.app-shell.has-global-search > main { grid-column: 2; grid-row: 2; }
.app-shell.has-global-search > .inbox-layout { height: calc(100dvh - var(--topbar-h)); }
.app-topbar { grid-column: 2; grid-row: 1; position: sticky; top: 0; z-index: 35; display: flex; align-items: center; gap: 12px; min-width: 0; height: var(--topbar-h); padding: 12px 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-business { display: none; }
.topbar-account { display: none; }
.topbar-web { height: 40px; margin-left: auto; }
.global-search { position: relative; display: flex; align-items: center; gap: 8px; flex: 1 1 320px; max-width: 560px; min-width: 0; height: 40px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.global-search:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--focus); }
.global-search-field { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.global-search-field input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 8px 2px; font-size: 13.5px; box-shadow: none !important; }
.global-search > select { max-width: 200px; min-width: 0; padding: 5px 26px 5px 9px; border-color: var(--line); font-size: 12.5px; }
.global-search-panel { position: absolute; top: calc(100% + 6px); left: 0; width: min(700px,calc(100vw - 32px)); max-height: min(620px,calc(100dvh - 140px)); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 12px; color: var(--ink); }
.global-search-status { margin: 3px 8px 9px; font-size: 12px; color: var(--muted); }
.global-search-panel h3 { margin: 13px 8px 5px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.global-search-panel ul { list-style: none; padding: 0; margin: 0; }
.global-search-panel li button { display: block; width: 100%; padding: 10px 8px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; white-space: normal; overflow-wrap: anywhere; color: var(--ink); }
.global-search-panel li button:hover,.global-search-panel li button:focus-visible { background: var(--accent-soft); }
.global-search-panel strong,.global-search-panel small { display: block; }
.global-search-panel small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.global-search-limit { margin: 5px 8px 10px; color: var(--muted); font-size: 12px; }
@media(max-width:640px) {
  :root { --topbar-h: 58px; }
  .app-topbar { position: sticky; top: 0; gap: 8px; padding: 8px 10px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); height: auto; min-height: var(--topbar-h); }
  .topbar-business { display: block; flex: 0 1 auto; max-width: 38%; min-width: 0; overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-business:empty { display: none; }
  .topbar-web { display: none !important; }
  .topbar-account { display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
  .topbar-account .avatar { width: 34px; height: 34px; font-size: 12px; }
  .global-search { flex: 1 1 auto; max-width: none; height: 38px; padding: 0 4px 0 10px; gap: 4px; }
  .global-search > select { max-width: 34%; font-size: 13px; }
  .global-search-field { gap: 2px; }
  .global-search-field input { font-size: 16px; padding: 7px 3px; }
  .global-search-panel { position: fixed; top: calc(var(--topbar-h) + 4px + env(safe-area-inset-top, 0px)); left: 8px; width: calc(100vw - 16px); max-height: calc(100dvh - 145px); }
  body:has(#inboxView:not([hidden]) #conversationDetail:not([hidden])) .app-topbar { display: none; }
  .global-search-panel li button { min-height: 44px; }
}
