/* The search popover must escape the entry/form stacking context when the
   signed-in "Pick up" shelf follows it in the DOM. */
.entry-content:has(.app-search-popover:not([hidden])) { z-index: 20; }
body:has(.app-search-popover:not([hidden])) .home-work { visibility: hidden; }

/* ReviewFold — app-name search palette.
   Scoped to the home form. No global selectors, no third-party UI. */

.app-search-field {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
}
.app-search-field > .url-field { flex: 1; }
.app-search-field input:focus-visible { outline: 2px solid var(--accent-ink, #526600); outline-offset: 1px; }
.app-search-field input::-webkit-search-cancel-button,
.app-search-field input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.app-search-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  display: flex;
  max-height: min(62vh, 540px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line, #dfe3e5);
  border-radius: 14px;
  background: var(--paper, #ffffff);
  box-shadow: 0 28px 70px -42px rgba(17, 21, 25, 0.55), 0 2px 8px rgba(17, 21, 25, 0.04);
  text-align: left;
}
.app-search-popover[hidden] { display: none !important; }

/* Search scope: Apple's region is explicit; Google stays US. */
.app-search-scope {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, #dfe3e5);
  background: #fbfaf5;
}
.app-search-scope-label {
  margin-right: 1px;
  color: var(--muted, #626970);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.app-search-scope .app-search-region {
  font-size: 9.5px;
  line-height: 1.2;
}
.app-search-region {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line, #dfe3e5);
  border-radius: 999px;
  background: var(--paper, #ffffff);
  color: var(--muted, #626970);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}
.app-search-region select {
  width: auto;
  min-height: 28px;
  margin: -2px -3px -2px 0;
  padding: 1px 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink, #111519);
  font: inherit;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.app-search-region select:focus-visible {
  outline: 2px solid var(--accent-ink, #526600);
  outline-offset: 2px;
}
.app-search-region select:disabled { opacity: .55; cursor: wait; }
.app-search-region--static { color: var(--ink, #111519); }
.app-search-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted, #626970);
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
}
.app-search-close:hover { background: #eef0f1; color: var(--ink, #111519); }
.app-search-close:focus-visible { outline: 2px solid var(--accent-ink, #526600); outline-offset: 2px; }

.app-search-results {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.app-search-result-group + .app-search-result-group { border-top: 1px solid var(--line, #dfe3e5); }
.app-search-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 6px;
}
.app-search-group-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted, #626970);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.3;
  text-transform: uppercase;
}
.app-search-store-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line, #dfe3e5);
  border-radius: 4px;
  background: var(--paper, #ffffff);
  color: var(--ink, #111519);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}
.app-search-group-mark--google { background: #f1f3f4; }
.app-search-group-count {
  color: var(--muted, #626970);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app-search-option {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 11px;
  min-height: 60px;
  padding: 7px 14px;
  border-top: 1px solid var(--line, #dfe3e5);
  background: var(--paper, #ffffff);
  color: var(--ink, #111519);
  cursor: pointer;
  outline: none;
  transition: background-color 0.14s ease, box-shadow 0.14s ease;
}
.app-search-option:hover,
.app-search-option.is-active { background: #f7fbe8; box-shadow: inset 2px 0 0 var(--accent, #d0f341); }
.app-search-option:focus-visible { box-shadow: inset 0 0 0 2px var(--accent-ink, #526600); }
.app-search-option-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 1px solid var(--line, #dfe3e5);
  border-radius: 10px;
  background: var(--surface, #f4f6f6);
  color: var(--muted, #626970);
  font-size: 15px;
  font-weight: 700;
}
.app-search-option-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.app-search-option-copy { display: grid; min-width: 0; gap: 2px; }
.app-search-option-copy strong {
  overflow-wrap: anywhere;
  color: var(--ink, #111519);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.app-search-option-developer {
  overflow-wrap: anywhere;
  color: var(--muted, #626970);
  font-size: 11.5px;
  line-height: 1.4;
}
.app-search-option-meta {
  margin-top: 1px;
  color: var(--muted, #626970);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}
.app-search-option-go {
  color: var(--muted, #626970);
  font-size: 14px;
  line-height: 1;
  text-align: right;
}
.app-search-option.is-active .app-search-option-go { color: var(--accent-ink, #526600); }

.app-search-group-state {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 14px 13px;
  border-top: 1px solid var(--line, #dfe3e5);
  color: var(--muted, #626970);
  font-size: 12px;
  line-height: 1.55;
}
.app-search-group-state button,
.app-search-link {
  min-height: 36px;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink, #111519);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.app-search-group-state button:hover,
.app-search-link:hover { color: var(--accent-ink, #526600); background: transparent; }
.app-search-group-state button:focus-visible,
.app-search-link:focus-visible { outline: 2px solid var(--accent-ink, #526600); outline-offset: 2px; }

/* Quiet skeleton rows while a store is still loading. */
.app-search-skeleton {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 60px;
  padding: 7px 14px;
  border-top: 1px solid var(--line, #dfe3e5);
}
.app-search-skeleton-tile,
.app-search-skeleton-line {
  display: block;
  border-radius: 6px;
  background: linear-gradient(100deg, #edf0f1 0 42%, #f8f9fa 50%, #edf0f1 58% 100%) 0 0 / 200% 100%;
  animation: app-search-sweep 1.5s linear infinite;
}
.app-search-skeleton-tile { width: 40px; height: 40px; border-radius: 10px; }
.app-search-skeleton-copy { display: grid; gap: 7px; }
.app-search-skeleton-line { width: 68%; height: 11px; }
.app-search-skeleton-line + .app-search-skeleton-line { width: 42%; height: 9px; }

.app-search-status {
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--line, #dfe3e5);
  background: #fbfaf5;
  color: var(--muted, #626970);
  font-size: 11.5px;
  line-height: 1.55;
}
.app-search-status:empty { display: none; }
.app-search-status--warning { background: #fff7e8; color: var(--warning-ink, #875010); }
.app-search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--line, #dfe3e5);
  background: #fbfaf5;
  color: var(--muted, #626970);
  font-size: 10.5px;
  line-height: 1.45;
}

/* Chosen identity receipt, in flow under the input. */
.app-search-selected {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin-top: 9px;
  padding: 9px 11px;
  border: 1px solid #e2edc4;
  border-radius: 11px;
  background: #f7fbe8;
}
.app-search-selected[hidden] { display: none !important; }
.app-search-selected-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid #dce8bd;
  border-radius: 8px;
  background: var(--paper, #ffffff);
  color: var(--muted, #626970);
  font-size: 13px;
  font-weight: 700;
}
.app-search-selected-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.app-search-selected-copy { display: grid; min-width: 0; gap: 1px; }
.app-search-selected-copy span:first-child {
  color: var(--accent-ink, #526600);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.3;
  text-transform: uppercase;
}
.app-search-selected-copy strong {
  overflow-wrap: anywhere;
  color: var(--ink, #111519);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.app-search-selected-copy small {
  overflow-wrap: anywhere;
  color: var(--muted, #626970);
  font-size: 10.5px;
  line-height: 1.4;
}
.app-search-clear {
  flex: 0 0 auto;
  min-height: 36px;
  margin-left: auto;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink, #111519);
  font: 600 10.5px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.app-search-clear:hover { color: var(--accent-ink, #526600); background: transparent; }
.app-search-clear:focus-visible { outline: 2px solid var(--accent-ink, #526600); outline-offset: 2px; }

@keyframes app-search-sweep {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (max-width: 540px) {
  .app-search-popover { max-height: min(56vh, 480px); border-radius: 12px; }
  .app-search-scope { padding: 9px 10px; gap: 6px; }
  .app-search-option { grid-template-columns: 38px minmax(0, 1fr) 14px; gap: 10px; min-height: 62px; padding: 10px 12px; }
  .app-search-option-icon { width: 38px; height: 38px; }
  .app-search-option-copy strong { font-size: 13.5px; }
  .app-search-group-head { padding: 11px 12px 5px; }
  .app-search-group-state { padding: 9px 12px 12px; }
  .app-search-status, .app-search-footer { padding-right: 12px; padding-left: 12px; }
  .app-search-selected { align-items: flex-start; }
  .app-search-selected-copy strong { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-search-option { transition: none; }
  .app-search-skeleton-tile,
  .app-search-skeleton-line { animation: none; background: #eef1f2; }
}

@media print {
  .app-search-popover, .app-search-selected { display: none !important; }
}
