* {
  box-sizing: border-box;
}

:root {
  --base-font-size: 14px;
}

html,
body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: #172b4d;
  background: #f5f7fb;
  font-size: var(--base-font-size);
}

h1,
h2,
h3 {
  margin: 0 0 8px;
}

p {
  margin: 0;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.demo-mode-banner {
  flex-shrink: 0;
  background: #b45309;
  color: #fff;
  text-align: center;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.stripe-feedback-banner {
  flex-shrink: 0;
  text-align: center;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.stripe-feedback-banner.stripe-feedback-success {
  background: #0f766e;
  color: #fff;
}

.stripe-feedback-banner.stripe-feedback-info {
  background: #1e4bd1;
  color: #fff;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: #ffffff;
  border-bottom: 1px solid #e0e6ef;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #1e4bd1;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand h1 {
  font-size: 1.57em;
}

.brand p {
  color: #5b6b88;
  font-size: 1em;
}

.cta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-email {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2fb;
  color: #1e2b5c;
  font-size: 13px;
  font-weight: 600;
}

.premium-badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f9d776, #f0b429);
  color: #442500;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 1em;
}

button.primary {
  background: #1e4bd1;
  color: #ffffff;
}

button.outline {
  background: transparent;
  border: 1px solid #d3dced;
  color: #1e2b5c;
}

button.secondary {
  background: #e6ecf7;
  color: #1e2b5c;
  width: 100%;
}

.auth-actions .secondary {
  width: auto;
}

.content {
  flex: 1;
  display: flex;
  min-height: 0;
}

.panel {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.panel h2 {
  font-size: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #4e5d78;
}

.field input,
.field select {
  border: 1px solid #d4dbe7;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: #172b4d;
}

.field-title {
  font-weight: 600;
  margin-bottom: 6px;
  display: inline-block;
  color: #1f2d4d;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 6px;
}

.checkbox.toggle {
  font-size: 13px;
  margin-bottom: 0;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.results-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  max-width: 100%;
}

.favorites-panel,
.settings-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.settings-panel {
  gap: 0;
}

.settings-panel > .results-header {
  flex-shrink: 0;
}

.settings-panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #1e2b5c;
}

.settings-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 140px);
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(30, 75, 209, 0.35) #e8ecf4;
  scrollbar-width: thin;
}

.favorites-panel > .results-header {
  flex-shrink: 0;
}

.setting-group {
  margin-bottom: 20px;
  padding: 16px;
  background: #f8f9fb;
  border-radius: 12px;
}

.setting-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 1em;
  font-weight: 600;
  color: #1e2b5c;
}

.setting-value {
  color: #5b6b88;
  font-size: 0.93em;
  font-weight: 500;
}

#fontSizeSlider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #d3dced;
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 8px;
}

#fontSizeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1e4bd1;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(30, 75, 209, 0.3);
}

#fontSizeSlider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1e4bd1;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(30, 75, 209, 0.3);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.79em;
  color: #7b879c;
  margin-top: 4px;
}

.subscription-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #f1e2b3;
  background: linear-gradient(135deg, #fff7e0, #fffdf4);
  flex-wrap: wrap;
}

.subscription-label {
  font-size: 12px;
  color: #7a6100;
  margin: 0;
}

.subscription-status {
  font-weight: 700;
  color: #1e2b5c;
  margin: 4px 0;
}

.subscription-price {
  font-size: 12px;
  color: #7a6100;
  margin: 0;
}

.subscription-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.close-panel-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: #7b879c;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.close-panel-btn:hover {
  background: #f0f2f5;
  color: #1e2b5c;
}

.results-header span {
  background: #eef2fb;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: #3f4b64;
}

.loading-state {
  padding: 8px 12px;
  border-radius: 10px;
  background: #eef2fb;
  color: #3f4b64;
  font-size: 12px;
  margin-bottom: 10px;
}

.error-state {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff0f0;
  border: 1px solid #f9c5c5;
  color: #8a1f1f;
  font-size: 12px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  flex: 1;
  min-height: 0;
  padding-bottom: 12px;
  max-width: 100%;
}

.card {
  position: relative;
  border: 1px solid #e0e6ef;
  border-radius: 12px;
  padding: 16px 16px 20px;
  background: #fdfdff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  box-sizing: border-box;
}

.card.active {
  border-color: #1e4bd1;
  box-shadow: 0 8px 18px rgba(30, 75, 209, 0.18);
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.card-header-tags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.card-header > .tag {
  margin-left: auto;
}

.tag {
  background: #e8f0ff;
  color: #1e4bd1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  height: fit-content;
  display: inline-flex;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-awarded {
  background: #ede9fe;
  color: #6b21a8;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  height: fit-content;
  display: inline-flex;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-expired {
  background: #e5e7eb;
  color: #4b5563;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  height: fit-content;
  display: inline-flex;
  flex-shrink: 0;
  white-space: nowrap;
}

.card h3 {
  font-size: 1.07em;
  color: #1b2b4b;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
  margin: 0;
  min-width: 0;
  flex: 1;
}

.card-details {
  display: grid;
  gap: 6px;
  font-size: 0.86em;
  color: #5b6b88;
  min-height: 84px;
  max-width: 100%;
  overflow: hidden;
}

.card-details div {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-details span {
  color: #1f2d4d;
  font-weight: 600;
}

.card-awardee-section {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #e8ecf4;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  min-height: 32px;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

.card {
  cursor: pointer;
}

.favorite-btn {
  cursor: pointer;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

.card button {
  background: #1e4bd1;
  color: #ffffff;
  font-size: 12px;
  padding: 6px 12px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.favorite-btn {
  background: #fffdf4;
  color: #1e2b5c;
  border: 1px solid #f3dea0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.favorite-btn.icon-only {
  padding: 4px;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  justify-content: center;
  background: transparent;
  border-color: transparent;
}

.favorite-btn.icon-only .star-icon {
  width: 14px;
  height: 14px;
}

.favorite-btn.active {
  background: #fff4c2;
  border-color: #f3c94b;
  color: #1e2b5c;
}

.favorite-btn.icon-only.active {
  background: transparent;
  border-color: transparent;
}

.star-icon {
  width: 16px;
  height: 16px;
  stroke: #f3c94b;
  stroke-width: 1.6;
  fill: transparent;
}

.star-icon.filled {
  fill: #f3c94b;
}

.favorite-btn.active .star-icon {
  fill: #f3c94b;
}

.map-pane {
  position: relative;
  flex: 1;
  height: 100%;
  min-height: 0;
  /* Ensure map has layout even when flex parents are still resolving (production / mobile) */
  min-height: 280px;
}

#map {
  position: relative;
  z-index: 0;
  height: 100%;
  width: 100%;
  min-height: 320px;
  background: #e8ecf4;
}

.leaflet-popup {
  z-index: 700;
}

.leaflet-popup-close-button {
  display: block !important;
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 8px;
  font-size: 20px;
  color: #666;
  background: white;
  border: none;
  cursor: pointer;
  width: 26px;
  height: 26px;
  text-align: center;
  line-height: 1;
  border-radius: 0 12px 0 0;
}

.leaflet-popup-close-button:hover {
  color: #333;
  background: #f5f5f5;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
}

.leaflet-popup-content {
  margin: 10px 18px 10px 14px;
  font-size: 12px;
  line-height: 1.4;
  padding-right: 20px;
}

.map-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 800;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.slide-panel.is-open ~ .map-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
}

.price-pin.leaflet-div-icon {
  background: transparent;
  border: none;
}

.price-pin {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.pin-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #1e4bd1;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 10px 18px rgba(30, 75, 209, 0.25);
  white-space: nowrap;
}

.pin-label.pin-awarded {
  background: #6b21a8;
  box-shadow: 0 10px 18px rgba(107, 33, 168, 0.3);
}

.pin-star {
  color: #f3c94b;
  font-size: 12px;
  line-height: 1;
}

.pin-amount {
  display: inline-flex;
  align-items: center;
}

.pin-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #f3c94b;
  color: #1e2b5c;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid #f9e4a6;
  box-shadow: 0 2px 6px rgba(30, 43, 92, 0.2);
}

.popup-list {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 12px;
  color: #4e5d78;
}

.pin-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: #1e4bd1 transparent transparent transparent;
}

.pin-label.pin-awarded::after {
  border-color: #6b21a8 transparent transparent transparent;
}

.panel-empty {
  margin-top: 12px;
  font-size: 13px;
  color: #5b6b88;
}

.locked-message {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #f1e2b3;
  background: #fffdf4;
  color: #7a6100;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
}

.upgrade-card {
  border: 1px solid #f1e2b3;
}

.premium-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  gap: 8px;
  color: #1e2b5c;
  font-size: 13px;
}

.premium-price {
  font-weight: 700;
  color: #1e2b5c;
  margin-bottom: 12px;
}

.upgrade-card .primary,
.upgrade-card .outline {
  width: 100%;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(92%, 420px);
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.2);
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #7b879c;
}

.auth-header {
  margin-bottom: 16px;
}

.auth-header p {
  color: #5b6b88;
  font-size: 13px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form button.primary {
  width: 100%;
}

.auth-switch {
  font-size: 12px;
  color: #5b6b88;
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-switch button {
  background: none;
  border: none;
  color: #1e4bd1;
  padding: 0;
  font-weight: 600;
}

.form-error {
  color: #b42318;
  background: #fff0f0;
  border: 1px solid #f9c5c5;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.preferences-card {
  background: #f0f4fb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid #e1e8f0;
}

.preferences-title {
  margin: 0 0 4px;
  font-size: 1rem;
  color: #1e2b5c;
}

.preferences-helper {
  color: #5b6b88;
  font-size: 12px;
  margin: 0 0 16px;
}

.preference-field {
  margin-bottom: 16px;
}

.preference-field.two-col {
  margin-bottom: 12px;
}

.preference-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1e2b5c;
  margin-bottom: 8px;
}

.state-selects-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preference-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  border: 2px solid #e1e8f0;
  border-radius: 8px;
  background: #fff;
  color: #172b4d;
}

.preference-select:focus {
  outline: none;
  border-color: #1e4bd1;
}

.preference-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid #e1e8f0;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  border-color: #b3c2d6;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip:has(input:checked) {
  border-color: #1e4bd1;
  background: #e8eeff;
  color: #1e4bd1;
  font-weight: 600;
}

.size-selects-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.size-select-wrap {
  flex: 1;
  min-width: 120px;
}

.size-sep {
  font-size: 12px;
  color: #7b879c;
}

.preferences-success {
  color: #0d6832;
  background: #e6f4ee;
  border: 1px solid #9ee6c3;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 12px;
}

.preferences-card .primary {
  width: 100%;
  margin-top: 4px;
}

.dev-panel {
  position: absolute;
  left: 20px;
  bottom: 90px;
  width: min(320px, 92vw);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18);
  border: 1px solid #e0e6ef;
  padding: 16px;
  z-index: 650;
}

.dev-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.dev-header h3 {
  font-size: 14px;
  margin: 0;
}

.dev-section {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.dev-section:last-child {
  margin-bottom: 0;
}

.dev-status {
  font-size: 12px;
  color: #5b6b88;
}

.dev-panel .secondary {
  width: auto;
}

.bottom-tabs {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d3dced;
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
  z-index: 600;
}

.tab-badge {
  background: #1e4bd1;
  color: #ffffff;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
  margin-left: 6px;
}

.card.locked {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.locked-content {
  filter: blur(5px);
  pointer-events: none;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: #1e2b5c;
  font-weight: 600;
  padding: 12px;
  transition: background 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.card.locked:hover .lock-overlay {
  background: rgba(255, 250, 230, 0.9);
  transform: translateY(-2px);
}

.lock-overlay .upgrade-cta {
  background: #1e2b5c;
  color: #ffffff;
  font-size: 12px;
  padding: 6px 12px;
}

.tab-button {
  border: none;
  background: transparent;
  color: #1e2b5c;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
}

.tab-button.active {
  background: #1e2b5c;
  color: #ffffff;
}

.hide-pin-labels .pin-label {
  display: none;
}

.hide-pin-labels .price-pin {
  align-items: flex-end;
}

.hide-pin-labels .price-pin::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1e4bd1;
  box-shadow: 0 8px 14px rgba(30, 75, 209, 0.3);
  display: inline-block;
}

.map-toggle {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d3dced;
  color: #1e2b5c;
  padding: 8px 14px;
  font-size: 13px;
}

.map-toggle.active {
  background: #1e2b5c;
  color: #ffffff;
}

.slide-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  height: calc(100% - 40px);
  width: 33%;
  min-width: 280px;
  max-width: 440px;
  z-index: 500;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  overflow: hidden;
}

.slide-panel.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.slide-panel .panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: 100%;
}

.filters-panel {
  gap: 8px;
  overflow-y: auto;
}

.empty-state {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
  font-size: 13px;
  color: #4e5d78;
}

.onboarding-card {
  max-width: 600px;
  width: 90%;
}

.step-subtitle {
  color: #7b879c;
  font-size: 14px;
  margin-bottom: 20px;
}

.state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.state-checkbox {
  padding: 12px;
  border: 2px solid #e1e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.state-checkbox input:checked + span {
  color: #1e4bd1;
  font-weight: 600;
}

.state-checkbox:has(input:checked) {
  border-color: #1e4bd1;
  background: #f0f4ff;
}

.industry-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.onboarding-navigation {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.onboarding-navigation button {
  flex: 1;
}

.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d3dced;
  transition: all 0.3s;
}

.progress-dot.active {
  background: #1e4bd1;
  width: 24px;
  border-radius: 4px;
}

.hidden {
  display: none;
}

@media (max-width: 960px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .map-pane {
    min-height: 60vh;
  }

  .slide-panel {
    width: calc(100% - 32px);
    max-width: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 16px;
  }

  .cta {
    width: 100%;
    justify-content: space-between;
  }

  .map-controls {
    top: 12px;
    right: 12px;
  }

  .slide-panel {
    top: 56px;
    right: 12px;
    height: calc(100% - 68px);
  }

  .bottom-tabs {
    bottom: 12px;
    width: calc(100% - 24px);
    justify-content: space-between;
  }
}

/* —— State onboarding (dark, on-brand) —— */
.state-onboarding-root {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.state-onboarding-root.hidden {
  display: none;
}

.state-onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 35, 0.78);
  backdrop-filter: blur(6px);
}

.state-onboarding-dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: min(92vh, 880px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 26px 22px;
  border-radius: 16px;
  background: linear-gradient(165deg, #1a2744 0%, #121a2e 45%, #0d1426 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(30, 75, 209, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #e8edf7;
}

.state-onboarding-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.state-onboarding-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #1e4bd1;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.state-onboarding-product {
  font-size: 14px;
  font-weight: 600;
  color: #9fb0d4;
  letter-spacing: 0.02em;
}

.state-onboarding-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #f4f7ff;
  letter-spacing: -0.02em;
}

.state-onboarding-sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #9fb0d4;
}

.state-onboarding-bulk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.state-onboarding-bulk-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #c5d0ea;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.state-onboarding-bulk-btn:hover {
  border-color: rgba(30, 75, 209, 0.65);
  background: rgba(30, 75, 209, 0.2);
  color: #ffffff;
}

.state-onboarding-bulk-btn:focus-visible {
  outline: 2px solid #3a6af0;
  outline-offset: 2px;
}

.state-onboarding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  overflow-y: auto;
  padding: 4px 2px 8px;
  flex: 1;
  min-height: 120px;
  max-height: 42vh;
  scrollbar-color: rgba(30, 75, 209, 0.5) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.state-onboarding-chip {
  margin: 0;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #c5d0ea;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.state-onboarding-chip:hover {
  border-color: rgba(30, 75, 209, 0.55);
  background: rgba(30, 75, 209, 0.18);
  color: #ffffff;
}

.state-onboarding-chip:focus-visible {
  outline: 2px solid #1e4bd1;
  outline-offset: 2px;
}

.state-onboarding-chip[aria-pressed="true"] {
  background: linear-gradient(145deg, #2a5ae8, #1e4bd1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(30, 75, 209, 0.35);
}

.state-onboarding-hint {
  margin: 0;
  font-size: 13px;
  color: #7d8fb3;
  min-height: 1.25em;
}

.state-onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.state-onboarding-back {
  margin-right: auto;
}

.state-onboarding-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.state-onboarding-progress-dots {
  display: flex;
  gap: 10px;
  align-items: center;
}

.state-onboarding-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.state-onboarding-dot.is-active {
  background: linear-gradient(145deg, #3a6af0, #1e4bd1);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.15);
}

.state-onboarding-step-label {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7d8fb3;
}

.state-onboarding-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

/* Wins over `.state-onboarding-step { display: flex }` so only one wizard step is visible */
.state-onboarding-dialog .state-onboarding-step.hidden {
  display: none;
}

.state-onboarding-industry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 4px 2px 12px;
  flex: 1;
  min-height: 160px;
  max-height: min(48vh, 420px);
  scrollbar-color: rgba(30, 75, 209, 0.5) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.state-onboarding-industry-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c5d0ea;
  cursor: pointer;
  text-align: left;
  outline: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.state-onboarding-industry-tile:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
}

.state-onboarding-industry-tile:focus-visible {
  box-shadow: 0 0 0 2px rgba(58, 106, 240, 0.55);
}

.state-onboarding-industry-tile.is-selected {
  border-color: rgba(58, 106, 240, 0.55);
  background: rgba(30, 75, 209, 0.22);
  box-shadow: 0 8px 22px rgba(30, 75, 209, 0.2);
}

.state-onboarding-industry-tile-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.state-onboarding-industry-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.state-onboarding-industry-label {
  font-size: 14px;
  font-weight: 700;
  color: #f4f7ff;
  line-height: 1.3;
}

.state-onboarding-industry-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #9fb0d4;
}

.state-onboarding-customize-link {
  align-self: flex-start;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 600;
  color: #7eb0ff;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.state-onboarding-customize-link:hover {
  color: #a8c8ff;
}

.state-onboarding-naics-customize {
  margin-top: 4px;
  padding: 10px 10px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.state-onboarding-naics-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.state-onboarding-naics-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #d2dbf0;
  cursor: pointer;
}

.state-onboarding-naics-row input {
  accent-color: #3a6af0;
}

.state-onboarding-btn {
  min-width: 120px;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}

.state-onboarding-btn-primary {
  background: linear-gradient(145deg, #3a6af0, #1e4bd1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(30, 75, 209, 0.3);
}

.state-onboarding-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.state-onboarding-btn-secondary {
  background: transparent;
  color: #b8c5e0;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.state-onboarding-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.settings-states-summary {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef2fb;
  color: #1e2b5c;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.settings-change-states-btn {
  width: 100%;
  max-width: 280px;
}

.settings-states-helper {
  margin-top: 8px !important;
  margin-bottom: 0 !important;
}
