/* Priciso — shared mobile / narrow-viewport layer (load after page <style>) */

html {
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

svg {
  max-width: 100%;
}

.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;
}

@media (max-width: 900px) {
  /* Auto landing */
  .hero-grid,
  .result-inner,
  .plans,
  .testi-grid {
    grid-template-columns: 1fr !important;
  }

  .steps {
    grid-template-columns: 1fr !important;
  }

  .form-row.triple,
  .form-row:not(.single) {
    grid-template-columns: 1fr !important;
  }

  .hero {
    min-height: 0 !important;
    padding-top: 56px !important;
  }

  /* Full report */
  .rh-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .price-hero,
  .pdf-footer {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .deal-score {
    min-width: 0;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  .insight-grid {
    grid-template-columns: 1fr !important;
  }

  .condition-grid {
    grid-template-columns: 1fr !important;
  }

  /* Valuation wizard */
  .grid2,
  .result-grid {
    grid-template-columns: 1fr !important;
  }

  .result-main {
    grid-template-columns: 1fr !important;
    justify-items: center;
    text-align: center;
  }

  .result-badge {
    justify-self: center;
  }

  .upgrade-banner {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
  }

  .upgrade-banner .ub-left {
    width: 100%;
    max-width: 520px;
  }

  .upgrade-banner .btn-upgrade,
  .upgrade-banner a.btn-upgrade {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
    text-align: center;
  }

  .trust-row {
    flex-direction: column;
    align-items: center;
    gap: 12px !important;
  }

  /* Account */
  .xsell {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

  .xsell .btn-xsell {
    justify-self: center;
  }

  .profile-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 768px) {
  /* Consistent sizing for native buttons (esp. iOS) */
  button,
  input[type="submit"],
  input[type="button"],
  input[type="reset"] {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
  }

  body {
    overflow-x: hidden;
  }

  nav:not(.home-nav) {
    flex-wrap: wrap;
    row-gap: 8px;
    height: auto !important;
    min-height: 56px;
    padding-top: max(10px, 2vw) !important;
    padding-bottom: max(10px, 2vw) !important;
  }

  nav.home-nav {
    flex-wrap: nowrap !important;
  }

  /* Let page CSS own flex direction; only ensure links can scroll horizontally when needed */
  .nav-links {
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .nav-links .btn-nav-cta,
  .nav-links .btn-nav,
  .nav-links .btn-nav-auto {
    align-self: center;
  }

  /* Full report */
  .report-header {
    padding: 24px 16px !important;
  }

  .rh-top {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px;
  }

  .report-id {
    text-align: left !important;
    width: 100%;
  }

  .rh-meta {
    flex-wrap: wrap !important;
    gap: 10px 16px !important;
  }

  .body {
    padding: 20px 16px !important;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .nav-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px !important;
  }

  nav[style*="display:flex"] {
    flex-wrap: wrap;
  }

  /* Valuation */
  .page,
  .progress-wrap,
  .step-wrap,
  .result-wrap {
    padding-left: max(14px, 4%) !important;
    padding-right: max(14px, 4%) !important;
  }

  .step-title {
    font-size: clamp(24px, 7vw, 32px) !important;
  }

  .result-price {
    font-size: clamp(32px, 10vw, 52px) !important;
  }

  .btn-row {
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px;
  }

  .btn-row .btn-back,
  .btn-row .btn-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    max-width: min(100%, 400px);
    text-align: center;
  }

  .btn-row .btn-next {
    padding-inline: 20px;
  }

  /* Tail row: desktop aligns end; column layout must not push sole control to bottom */
  .btn-row.btn-row--tail {
    justify-content: flex-start;
  }

  /* Auth */
  .shell {
    padding: 24px 16px !important;
    align-items: flex-start !important;
  }

  .card {
    padding: 28px 22px !important;
  }

  /* Account top bar */
  .top-nav {
    height: auto !important;
    min-height: 52px;
    padding: 10px 14px !important;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-right {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
  }

  .top-nav .nav-right {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .top-nav .nav-pill,
  .top-nav .btn-get-val {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .page-header {
    flex-direction: column !important;
    gap: 14px;
    align-items: stretch !important;
  }

  .ph-actions {
    width: 100%;
    max-width: min(100%, 360px);
    align-self: center;
    flex-wrap: wrap;
  }

  .ph-actions .btn-sm-primary,
  .ph-actions .btn-sm-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    text-align: center;
  }

  /* Timeline charts (full report) */
  .timeline {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
  }

  .tl-item {
    flex: 0 0 auto;
    min-width: 76px;
  }

  .ph-price {
    font-size: clamp(28px, 9vw, 46px) !important;
  }

  .rh-title {
    font-size: clamp(22px, 6vw, 28px) !important;
  }
}

@media (max-width: 700px) {
  .layout {
    display: block !important;
    min-height: 0 !important;
  }

  .sidebar {
    display: none !important;
  }

  .account-mobile-select-wrap {
    display: block !important;
    margin: 0 0 18px;
    padding: 14px;
    background: var(--white, #fff);
    border: 1px solid var(--border, #e2e7f0);
    border-radius: var(--r, 12px);
    box-shadow: 0 2px 12px rgba(11, 17, 32, 0.05);
  }

  .main {
    padding: 16px 14px 32px !important;
    overflow: visible !important;
  }

  .account-mobile-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
  }

  .account-mobile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--navy, #0b1120);
    color: var(--white, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
  }

  .account-mobile-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text, #0b1120);
    line-height: 1.2;
  }

  .account-mobile-plan {
    font-size: 12px;
    color: var(--text-muted, #7a8699);
    margin-top: 2px;
  }

  .account-mobile-tabs {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    padding-bottom: 3px;
  }

  .account-mobile-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 13px;
    border: 1.5px solid var(--border, #e2e7f0);
    border-radius: var(--rs, 8px);
    background: var(--white, #fff);
    color: var(--text-mid, #3d4a5c);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    scroll-snap-align: start;
  }

  .account-mobile-tab span {
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface, #f8f9fc);
    color: var(--text-muted, #7a8699);
    font-size: 11px;
  }

  .account-mobile-tab.active {
    border-color: var(--accent, #1a6bff);
    background: var(--accent-light, #eef3ff);
    color: var(--accent, #1a6bff);
    box-shadow: 0 0 0 1px rgba(26, 107, 255, 0.12);
  }

  .account-mobile-tab.active span {
    background: rgba(26, 107, 255, 0.12);
    color: var(--accent, #1a6bff);
  }

  .account-page-select {
    background-image:
      linear-gradient(45deg, transparent 50%, var(--text-muted, #7a8699) 50%),
      linear-gradient(135deg, var(--text-muted, #7a8699) 50%, transparent 50%) !important;
    background-position:
      calc(100% - 18px) calc(50% - 3px),
      calc(100% - 13px) calc(50% - 3px) !important;
    background-size: 5px 5px, 5px 5px !important;
    background-repeat: no-repeat !important;
    padding-right: 36px !important;
  }

  .page-header {
    margin-bottom: 18px !important;
  }

  .ph-sub {
    line-height: 1.5;
  }
}

@media (max-width: 640px) {
  .rh-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-grid {
    grid-template-columns: 1fr !important;
  }

  .year-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .grid4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .service-cards {
    grid-template-columns: 1fr !important;
  }

  .hero-stats {
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: flex-start !important;
  }

  .data-nums {
    gap: 32px !important;
  }

  section {
    padding: 56px 5% !important;
  }

  .grid2 {
    grid-template-columns: 1fr !important;
  }

  /* Property page: restore nav items that were display:none on small screens */
  nav .nav-links .nav-link:not(.keep) {
    display: inline-flex !important;
  }

  nav .nav-links {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding-bottom: 4px;
  }

  .rec-box {
    flex-direction: column !important;
  }

  .val-row {
    flex-wrap: wrap;
    gap: 12px;
  }

  .val-row .vr-action {
    flex-basis: 100%;
    width: 100%;
    margin-left: 0;
    display: flex;
    justify-content: flex-start;
  }

  .val-row .vr-action .btn-row-action,
  .val-row .vr-action a.btn-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    box-sizing: border-box;
  }

  .vr-price {
    width: 100%;
    text-align: left;
  }

  .lr-actions {
    margin-left: 0 !important;
    width: 100%;
    justify-content: flex-end;
  }

  .upgrade-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .tab-bar {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .layout .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .stat-card {
    padding: 15px 14px !important;
  }

  .sc-val {
    font-size: clamp(22px, 8vw, 26px) !important;
  }

  .block-head {
    padding: 14px 16px !important;
    gap: 12px;
  }

  .block-action {
    flex: 0 0 auto;
  }

  .val-row,
  .report-row,
  .lead-row,
  .notif-row {
    align-items: flex-start !important;
    gap: 10px 12px !important;
    padding: 14px 16px !important;
  }

  .vr-info,
  .rr-info,
  .lr-info,
  .notif-body {
    min-width: 0;
    flex: 1 1 calc(100% - 54px);
  }

  .vr-name,
  .rr-name,
  .lr-name {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.35;
  }

  .vr-meta,
  .rr-meta,
  .lr-detail,
  .notif-sub {
    line-height: 1.45;
  }

  .vr-badge,
  .lr-status {
    margin-left: 52px;
  }

  .rr-price,
  .rr-dl,
  .lr-actions {
    margin-left: 52px !important;
  }

  .rr-dl,
  .lr-actions .btn-row-action,
  .val-row .vr-action .btn-row-action,
  .val-row .vr-action a.btn-row-action {
    min-height: 36px;
  }

  .notif-time {
    margin-left: 50px;
  }

  .unread-dot {
    margin-left: auto;
  }

  .toggle-row {
    align-items: flex-start !important;
    gap: 14px;
  }

  .toggle-info-sub {
    line-height: 1.45;
  }

  .upgrade-bar .ub-left {
    align-items: flex-start !important;
  }

  .car-schematic {
    border-radius: 12px !important;
  }

  .car-schematic-inner {
    padding: 16px 10px 14px !important;
  }

  .mileage-row {
    align-items: stretch !important;
  }
}

@media (max-width: 520px) {
  .top-nav {
    align-items: flex-start !important;
  }

  .top-nav .nav-right {
    flex-basis: 100%;
    justify-content: flex-start;
    gap: 8px !important;
    padding-bottom: 2px;
  }

  .top-nav .nav-divider,
  .top-nav .avatar {
    display: none !important;
  }

  .mileage-row {
    flex-direction: column;
    gap: 10px !important;
  }

  .mileage-val {
    min-width: 0 !important;
    text-align: left !important;
  }

  .panels-legend {
    grid-template-columns: 1fr !important;
  }

  .locked-card {
    padding: 18px !important;
  }

  .unlock-cta-sub br {
    display: none;
  }
}

@media (max-width: 430px) {
  .layout .stat-grid,
  .rh-grid {
    grid-template-columns: 1fr !important;
  }

  .vr-price,
  .vr-badge,
  .vr-action,
  .rr-price,
  .rr-dl,
  .lr-status,
  .lr-actions,
  .notif-time {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100%;
  }

  .rr-dl,
  .lr-actions,
  .lr-actions .btn-row-action,
  .val-row .vr-action .btn-row-action,
  .val-row .vr-action a.btn-row-action {
    width: 100%;
    justify-content: center;
  }
}

/* Scroll wide tables without breaking layout */
.table-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table-x .comparables {
  min-width: 560px;
}

/* Account: mobile section picker (hidden on desktop via inline / page rule) */
.account-mobile-select-wrap {
  display: none;
}

.account-page-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border, #e2e7f0);
  font-family: inherit;
  font-size: 15px;
  background: var(--white, #fff);
  color: var(--text, #0b1120);
}
