/* Top toolbar — compact card, attached panels */
.sg-toolbar {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  z-index: 30;
  pointer-events: none;
}
.sg-toolbar__card {
  pointer-events: auto;
  width: min(420px, calc(100vw - 20px));
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1);
  border: 1px solid rgba(15, 23, 42, 0.06);
  overflow: hidden;
}
.sg-toolbar__row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  min-height: 44px;
}

.sg-toolbar__progress {
  padding: 0 10px 8px;
  border-top: 1px solid #f1f5f9;
}

.sg-toolbar__progress-track {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}

.sg-toolbar__progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.sg-toolbar__progress-text {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}
.sg-toolbar__logo {
  flex-shrink: 0;
  display: flex;
  line-height: 0;
  padding: 2px;
}
.sg-toolbar__logo img { border-radius: 50%; display: block; }
.sg-toolbar__search-wrap {
  flex: 1;
  min-width: 0;
}
.sg-toolbar__search {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 16px;
  padding: 6px 4px;
  outline: none;
  color: #0f172a;
}
.sg-toolbar__search::placeholder { color: #94a3b8; }
.sg-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  border-left: 1px solid #e2e8f0;
  padding-left: 2px;
  margin-left: 2px;
}
.sg-icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: #475569;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sg-icon-btn:hover { background: #f1f5f9; color: #0f172a; }
.sg-icon-btn[aria-expanded="true"] {
  color: #2563eb;
  background: #eff6ff;
}

/* Attached dropdown panels — no floating shadow gap */
.sg-toolbar__panel {
  border-top: 1px solid #e2e8f0;
  background: #fff;
  max-height: min(52vh, 380px);
  overflow: auto;
}
.sg-toolbar__panel[hidden] { display: none !important; }

.sg-filter-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.sg-filter-tabs__btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 7px 6px 8px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: color .12s ease, background .12s ease;
}
.sg-filter-tabs__btn:hover { color: #334155; background: #f8fafc; }
.sg-filter-tabs__btn.is-active {
  color: #2563eb;
  background: #eff6ff;
}
.sg-filter-tabs__btn[hidden] { display: none !important; }

.sg-filter-menu__head {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 33px;
  background: #fff;
  z-index: 1;
}
.sg-filter-panel[hidden] { display: none !important; }

.sg-filter-detail {
  padding: 8px 10px 10px;
}
.sg-filter-detail__group {
  border: none;
  margin: 0 0 10px;
  padding: 0;
}
.sg-filter-detail__group:last-child { margin-bottom: 0; }
.sg-filter-detail__group legend {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 0 6px;
}
.sg-filter-detail__opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sg-filter-detail__opts--stack {
  flex-direction: column;
  gap: 4px;
}
.sg-filter-detail__opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #0f172a;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  background: #f8fafc;
  user-select: none;
}
.sg-filter-detail__opt:hover { background: #f1f5f9; }
.sg-filter-detail__opt input {
  accent-color: #2563eb;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}
.sg-filter-detail__opt--tier {
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
  padding: 7px 10px;
}
.sg-filter-detail__opt-text {
  flex: 1;
  line-height: 1.3;
}
.sg-filter-tier-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 999px;
  box-sizing: border-box;
}
.sg-filter-tier-pin--1 {
  width: 22px;
  height: 22px;
  background: #facc15;
  color: #0f172a;
  font-size: 10px;
}
.sg-filter-tier-pin--2 {
  width: 22px;
  height: 22px;
  background: #2563eb;
  color: #fff;
  font-size: 10px;
}
.sg-filter-tier-pin--3 {
  width: 14px;
  height: 14px;
  background: #64748b;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
}
.sg-filter-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.sg-filter-list li {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
}
.sg-filter-list__hit {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 9px 10px 9px 12px;
  cursor: pointer;
  transition: background .12s ease;
}
.sg-filter-list__hit:hover,
.sg-filter-list li:focus-within .sg-filter-list__hit {
  background: #f8fafc;
}
.sg-filter-cat-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 10px;
  box-sizing: border-box;
}
.sg-filter-menu__head[hidden] { display: none !important; }
.sg-filter-list input {
  accent-color: #2563eb;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  cursor: pointer;
}
.sg-filter-list__label {
  flex: 1;
  font-size: 14px;
  color: #0f172a;
  min-width: 0;
}
.sg-filter-list__count {
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  min-width: 24px;
  text-align: center;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.sg-filter-list__flag {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.sg-filter-list__goto {
  flex-shrink: 0;
  align-self: center;
  width: 32px;
  height: 32px;
  margin: 0 10px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
}
.sg-filter-list__goto:hover {
  background: #e2e8f0;
  color: #2563eb;
}
.sg-search-results__flag {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  background: #f8fafc;
  border-radius: 10px;
}
.sg-search-results__section {
  margin: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.sg-search-results ul { list-style: none; margin: 0; padding: 4px 0; }
.sg-search-results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .12s ease;
}
.sg-search-results li:hover,
.sg-search-results li:focus-visible { background: #f8fafc; outline: none; }
.sg-search-results__empty {
  padding: 12px;
  color: #64748b;
  font-size: 14px;
  margin: 0;
}
.sg-search-results__thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #e2e8f0;
}
.sg-search-results__body { min-width: 0; flex: 1; }
.sg-search-results__name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: #0f172a;
}
.sg-search-results__cat {
  font-size: 12px;
  color: #64748b;
  margin-top: 1px;
}

.sg-nearby-warning {
  padding: 12px 10px;
}
.sg-nearby-warning__text {
  margin: 0 0 10px 0;
  color: #64748b;
  font-size: 14px;
}

.sg-nearby-section {
  padding: 6px 10px 10px;
}
.sg-nearby-section__title {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.sg-nearby-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sg-gps-banner {
  position: fixed;
  top: calc(max(10px, env(safe-area-inset-top)) + 58px);
  left: 10px;
  max-width: min(400px, calc(100vw - 20px));
  z-index: 28;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.sg-gps-banner__text { margin: 0; font-size: 14px; flex: 1; }
.sg-gps-banner__cta {
  white-space: nowrap;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
}
.sg-gps-banner__close {
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #94a3b8;
  line-height: 1;
  padding: 4px;
}
.sg-settings-fab {
  position: fixed;
  left: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 25;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(15, 23, 42, 0.06);
  cursor: pointer;
  font-size: 16px;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sg-settings-fab--secondary {
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 48px);
}

.sg-settings-fab.is-loading {
  pointer-events: none;
  cursor: default;
}

.sg-settings-fab.is-loading > i {
  visibility: hidden;
}

.sg-settings-fab.is-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: sg-spin 0.65s linear infinite;
}

@keyframes sg-spin {
  to { transform: rotate(360deg); }
}
