.portal-header .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.portal-header .account-button { text-decoration: none; }
.portal-tag {
  display: inline-block;
  color: #566e50;
  background: #e9eee1;
  border-radius: 20px;
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}
.portal-source-row { min-height: 58px; }
.portal-source-label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.portal-external {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 16px 18px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef1e6;
}
.portal-external h3 { font-size: 14px; margin: 0 0 4px; }
.portal-external p { margin: 0; }
.portal-external-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.portal-external-actions button { font-size: 11px; }
.portal-external-actions button:disabled { opacity: .6; cursor: default; }
.portal-button-link { display: inline-block; text-decoration: none; }
.portal-coming-soon { min-height: 48vh; }
.portal-coming-soon p { margin: 12px 0 24px; }
.portal-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}
.portal-footer-links a:hover { text-decoration: underline; }
.legal-page { max-width: 820px; padding-inline: clamp(20px, 5vw, 48px); }
.legal-page section { scroll-margin-top: 20px; }
.legal-page .panel h2 { margin-bottom: 12px; }
.legal-page .panel h3 { margin: 24px 0 8px; }
.legal-page .panel p:last-child { margin-bottom: 0; }
.legal-page address { font-style: normal; margin-bottom: 14px; }
.legal-page .panel a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
#calculator .upload-area { margin-top: 16px; }
@media (max-width: 650px) {
  .portal-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 16px;
  }
  .portal-header nav {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    height: auto;
  }
  .portal-header .nav-link {
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    min-height: 44px;
    gap: 2px 4px;
    text-align: center;
  }
  .portal-header .nav-link.active::after { left: 50%; transform: translateX(-50%); }
  .portal-header .account-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding-inline: 10px;
  }
  .portal-header .portal-tag { font-size: 8px; }

  #discover-view .hero { min-height: 0; padding-top: 28px; }
  #discover-view .hero h1 { font-size: clamp(2.2rem, 11vw, 3.25rem); }
  #hero-search input { min-height: 44px; font-size: 16px; }
  #hero-search .primary, .filter-toggle { min-height: 44px; }
  #hero-search .primary span { margin-left: 4px; }
  #discover-view .hero-art { min-height: 0; overflow: hidden; }
  #discover-view .hero-art > img { height: auto; }
  #discover-view .orbit { width: min(86%, 270px); height: auto; aspect-ratio: 1; }
  #discover-view .orbit-two { width: min(94%, 320px); aspect-ratio: 2; }
  #discover-view .hero-sticker { top: 8px; right: 8px; width: 68px; height: 68px; }
  #discover-view .floating-label { left: 12px; bottom: 7px; padding: 6px 10px; }

  .portal-source-row { min-height: 0; align-items: stretch; padding-bottom: 12px; }
  .portal-source-label { padding: 0; }
  .portal-source-row .recency-controls, .extra-filters:not([hidden]), .portal-external-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .portal-source-row .sort-label, .extra-filters label {
    min-width: 0;
    max-width: none;
    font-size: 12px;
  }
  .portal-source-row select, .extra-filters input {
    width: 100%;
    max-width: none;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
  }
  .extra-filters button, .portal-external-actions button { min-height: 44px; font-size: 12px; }
  .portal-external-actions { width: 100%; }
  .results-summary, .data-note, .source-check p { font-size: 12px; overflow-wrap: anywhere; }
  .live-card .card-title { min-height: 44px; font-size: 15px; overflow-wrap: anywhere; }
  .live-card .card-condition, .listing-date, .live-disclaimer { font-size: 12px; }
  .listing-date small { font-size: 11px; }
  .live-price { font-size: 20px; }
  .listing-actions { flex-wrap: wrap; padding-top: 4px; }
  .listing-actions .text-button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 12px;
  }
  .search-pagination { padding-inline: 0; }
  .search-pagination button { min-width: 0; max-width: 100%; white-space: normal; }

  #modal.listing-preview-dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 12px 16px 20px;
    overscroll-behavior: contain;
  }
  #modal.listing-preview-dialog .modal-close {
    position: sticky;
    top: 0;
    right: auto;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    line-height: 1;
  }
  #modal .preview-image { height: clamp(175px, 52vw, 250px); }
  #modal .preview-description { font-size: 14px; overflow-wrap: anywhere; }
  #modal .preview-original { min-height: 44px; font-size: 12px; }
}

@media (max-width: 430px) {
  #hero-search > span { display: none; }
  #hero-search input { padding-inline: 8px; }
  .portal-source-row .recency-controls, .portal-external-actions, #discover-view .cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .live-card .card-picture { height: clamp(160px, 48vw, 210px); }
}
