:root {
  --paper: #f1ece0;
  --panel: #fffaf2;
  --ink: #17313b;
  --muted: #566c75;
  --accent: #1f6f62;
  --accent-strong: #0f5447;
  --water: #3b8dad;
  --route: #d45c2c;
  --line: rgba(23, 49, 59, 0.14);
  --shadow: 0 20px 52px rgba(23, 49, 59, 0.16);
  --sans: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(180deg, #e8f3f5 0%, #f1ece0 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.boat-finder-app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.94);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.brand span span,
.result-card p,
.site-footer p {
  color: var(--muted);
}

.finder-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  min-height: 0;
  transition: grid-template-columns 360ms ease, max-width 360ms ease;
}

.search-panel,
.results-panel,
.comparison-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: var(--shadow);
}

.search-panel {
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 18px;
  transition: transform 360ms ease, max-width 360ms ease;
}

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

.panel-kicker {
  margin: 0 0 3px;
  color: var(--water);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-header h2 {
  margin: 0;
  font-size: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(31, 111, 98, 0.25);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(31, 111, 98, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill[data-state="unavailable"] {
  color: #744619;
  border-color: rgba(212, 92, 44, 0.24);
  background: rgba(244, 184, 92, 0.2);
}

.status-pill.is-busy {
  opacity: 0.7;
}

.chat-transcript {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding: 4px;
}

.chat-message {
  display: grid;
  gap: 4px;
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  animation: chatCardIn 220ms ease both;
}

.chat-message > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-message p {
  margin: 0;
}

.chat-message-user {
  justify-self: end;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.chat-message-user > span {
  color: rgba(255, 255, 255, 0.78);
}

.chat-message-assistant {
  justify-self: start;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 21px;
}

.typing-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: typingDot 900ms ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 240ms;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.composer-label textarea {
  min-height: 96px;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.primary-button {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 750;
}

.primary-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.78;
}

.secondary-button,
.icon-button {
  color: var(--ink);
  background: #fff;
}

.shortlist-button {
  min-width: 138px;
  white-space: nowrap;
}

.shortlist-button.is-shortlisted {
  color: var(--accent-strong);
  border-color: rgba(31, 111, 98, 0.34);
  background: rgba(31, 111, 98, 0.1);
}

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

.requirement-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(31, 111, 98, 0.28);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(31, 111, 98, 0.08);
  font-size: 0.86rem;
  font-weight: 700;
}

.manual-entry-toggle {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 24px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.manual-entry-toggle::before,
.manual-entry-toggle::after {
  content: "";
  grid-row: 1;
  height: 1px;
  background: var(--line);
}

.manual-entry-toggle::before {
  grid-column: 1;
}

.manual-entry-toggle::after {
  grid-column: 3;
}

.manual-entry-toggle span:first-child {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.manual-entry-chevron {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: center;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.manual-entry-toggle[aria-expanded="true"] .manual-entry-chevron {
  transform: rotate(225deg);
}

.manual-entry-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  transition: grid-template-rows 220ms ease, opacity 180ms ease, margin-top 220ms ease;
}

.manual-entry-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: -4px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow: hidden;
}

.control-grid label {
  gap: 4px;
}

.control-grid label span {
  font-size: 0.68rem;
}

.control-grid input,
.control-grid select {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 0.88rem;
}

.results-panel {
  min-width: 0;
  padding: 18px;
  overflow: auto;
  transform-origin: left center;
  transition: opacity 260ms ease, transform 320ms ease;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.7rem;
}

.outbound-notice {
  margin: 14px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(59, 141, 173, 0.12);
}

.outbound-notice {
  color: var(--accent-strong);
  background: rgba(31, 111, 98, 0.12);
}

.results-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.results-list.is-populating {
  opacity: 0;
  transform: translateY(8px);
}

.result-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid rgba(23, 49, 59, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(23, 49, 59, 0.12);
  cursor: pointer;
  animation: resultCardIn 260ms ease both;
}

.result-card:focus-visible {
  outline: 3px solid rgba(31, 111, 98, 0.55);
  outline-offset: 3px;
}

.result-card-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: rgba(59, 141, 173, 0.12);
}

.result-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(23, 49, 59, 0.5) 0%, rgba(23, 49, 59, 0.08) 38%, rgba(23, 49, 59, 0.58) 100%),
    linear-gradient(90deg, rgba(23, 49, 59, 0.24), rgba(23, 49, 59, 0));
  pointer-events: none;
}

.result-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recommendation-ribbon {
  position: absolute;
  top: 30px;
  right: -70px;
  z-index: 3;
  width: 240px;
  padding: 8px 12px;
  transform: rotate(35deg);
  color: #fff;
  background: var(--route);
  box-shadow: 0 8px 20px rgba(23, 49, 59, 0.22);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.1;
  overflow: visible;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.result-card-image-name {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  max-width: min(58%, 260px);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 850;
  line-height: 1.12;
  text-shadow: 0 2px 12px rgba(23, 49, 59, 0.55);
}

.result-card-image-facts {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: flex-end;
  max-width: calc(100% - 24px);
}

.result-card-image-facts span {
  max-width: 170px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  background: rgba(23, 49, 59, 0.72);
  box-shadow: 0 8px 20px rgba(23, 49, 59, 0.14);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.12;
  text-align: right;
  white-space: nowrap;
}

.result-card-body {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(180deg, #fff 0%, #f7fbfa 100%);
}

.result-card-subtitle,
.ai-assessment,
.result-card-commercial span {
  margin: 0;
  color: var(--muted);
}

.result-card h2 {
  font-size: 1.08rem;
}

.result-card-subtitle {
  margin-top: 4px;
  font-size: 0.88rem;
  line-height: 1.35;
}

.result-card-commercial {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(31, 111, 98, 0.14);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.82);
}

.result-card-commercial strong {
  color: var(--ink);
  font-size: 1.03rem;
  line-height: 1.2;
}

.result-card-commercial span {
  max-width: 48%;
  text-align: right;
  font-size: 0.78rem;
  line-height: 1.25;
}

.fit-label {
  margin: 0 0 4px;
  font-weight: 800;
  color: var(--route);
}

.ai-assessment {
  min-height: 88px;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid rgba(59, 141, 173, 0.16);
  background: rgba(59, 141, 173, 0.08);
  color: var(--accent-strong);
  font-size: 0.88rem;
  line-height: 1.35;
}

.result-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-facts span {
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(59, 141, 173, 0.24);
  border-radius: 999px;
  color: #255a6d;
  background: rgba(59, 141, 173, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
}

.result-facts.compact span {
  font-size: 0.76rem;
}

.match-list {
  margin: 0;
  padding-left: 18px;
}

.preference-evidence {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(31, 111, 98, 0.18);
  border-radius: 8px;
  background: rgba(31, 111, 98, 0.07);
}

.preference-evidence p,
.preference-evidence ul {
  margin: 0;
}

.preference-evidence p {
  color: var(--accent-strong);
  font-weight: 800;
}

.preference-evidence ul {
  padding-left: 18px;
}

.preference-evidence span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.tradeoff,
.caveat {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
}

.tradeoff {
  color: #6a4217;
  background: rgba(244, 184, 92, 0.22);
}

.caveat {
  background: rgba(23, 49, 59, 0.06);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.card-actions > * {
  position: relative;
  z-index: 3;
  justify-content: center;
  text-align: center;
}

.see-more-button {
  margin-top: 14px;
  width: 100%;
}

.boat-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) minmax(0, 1180px) minmax(44px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: rgba(23, 49, 59, 0.42);
}

.boat-detail-modal[hidden] {
  display: none;
}

.boat-detail-window {
  position: relative;
  grid-column: 2;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(23, 49, 59, 0.28);
  animation: detailModalIn 260ms ease both;
}

.detail-close {
  position: sticky;
  top: 12px;
  float: right;
  z-index: 5;
  margin: 12px 12px 0 0;
  background: #fff;
}

.detail-boat-nav {
  position: fixed;
  top: 50%;
  z-index: 45;
  width: 46px;
  min-height: 54px;
  transform: translateY(-50%);
  color: #fff;
  background: rgba(23, 49, 59, 0.76);
  border-color: rgba(255, 255, 255, 0.22);
  font-size: 2rem;
}

.detail-boat-prev {
  left: max(24px, calc((100vw - 1180px) / 2 + 14px));
}

.detail-boat-next {
  right: max(24px, calc((100vw - 1180px) / 2 + 14px));
}

.boat-detail-body {
  display: grid;
  gap: 18px;
  padding: 18px;
  clear: both;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.detail-gallery-stack {
  display: grid;
  gap: 6px;
}

.detail-gallery {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(59, 141, 173, 0.12);
}

.detail-main-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.detail-ribbon {
  top: 30px;
  right: -48px;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 40px;
  min-height: 48px;
  transform: translateY(-50%);
  color: #fff;
  background: rgba(23, 49, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.22);
  font-size: 1.8rem;
}

.gallery-prev {
  left: 10px;
}

.gallery-next {
  right: 10px;
}

.gallery-count {
  margin: 0;
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.detail-summary {
  display: grid;
  gap: 12px;
}

.detail-summary h2 {
  font-size: 1.8rem;
}

.detail-summary p {
  margin: 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-content-grid,
.feature-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

.detail-section {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(31, 111, 98, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.96);
  box-shadow: 0 16px 38px rgba(23, 49, 59, 0.1);
}

.detail-section h3 {
  margin: 0;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(31, 111, 98, 0.16);
  color: var(--accent-strong);
  font-size: 1rem;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
}

.detail-facts div {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 68px;
  padding: 10px;
  border: 1px solid rgba(59, 141, 173, 0.14);
  border-radius: 8px;
  background: rgba(232, 243, 245, 0.62);
}

.detail-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-facts dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-weight: 750;
  line-height: 1.3;
}

.floorplan-image {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(59, 141, 173, 0.16);
  border-radius: 8px;
  background: rgba(232, 243, 245, 0.58);
}

.floorplan-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.feature-group ul {
  display: grid;
  align-content: start;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

.feature-group li {
  color: var(--ink);
  line-height: 1.38;
}

.feature-group li::marker {
  color: var(--accent);
}

.comparison-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 10;
  max-height: min(75vh, 620px);
  padding: 16px;
  overflow: auto;
}

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

.comparison-grid {
  display: grid;
  min-width: 680px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.comparison-grid > * {
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.comparison-grid strong {
  background: var(--panel);
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.results-empty {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.site-footer {
  padding: 8px 24px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.95);
}

.site-footer p {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.35;
}

.boat-finder-app:not(.has-results) .finder-shell {
  align-content: center;
  justify-content: center;
  grid-template-columns: minmax(360px, 720px);
  width: 100%;
}

.boat-finder-app:not(.has-results) .search-panel {
  width: min(720px, 100%);
}

.boat-finder-app:not(.has-results) .chat-transcript {
  max-height: 360px;
}

.boat-finder-app:not(.has-results) .results-panel {
  visibility: hidden;
  max-height: 0;
  padding-block: 0;
  border-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: scaleX(0.94) translateX(18px);
}

.boat-finder-app.has-results .search-panel {
  animation: searchPanelSlideLeft 360ms ease both;
}

.boat-finder-app.has-results .results-panel {
  animation: resultsPanelGrowIn 360ms ease both;
}

@keyframes chatCardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes resultCardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingDot {
  0%,
  70%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@keyframes searchPanelSlideLeft {
  from {
    transform: translateX(90px);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes resultsPanelGrowIn {
  from {
    opacity: 0;
    transform: scaleX(0.92) translateX(-12px);
  }
  to {
    opacity: 1;
    transform: scaleX(1) translateX(0);
  }
}

@keyframes detailModalIn {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 880px) {
  .finder-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .boat-finder-app:not(.has-results) .finder-shell {
    align-content: start;
    grid-template-columns: 1fr;
  }

  .topbar,
  .results-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .results-list {
    grid-template-columns: 1fr;
  }

  .site-footer {
    padding: 8px 12px 10px;
  }

  .result-card-media {
    aspect-ratio: 16 / 10;
  }

  .comparison-panel {
    inset: auto 8px 8px 8px;
  }

  .boat-detail-modal {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 6px;
    padding: 8px;
  }

  .boat-detail-window {
    max-height: calc(100vh - 16px);
  }

  .boat-detail-body {
    padding: 12px;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-boat-nav {
    width: 38px;
    min-height: 48px;
  }

  .result-card-image-name {
    max-width: 54%;
  }

  .recommendation-ribbon {
    top: 26px;
    right: -70px;
    width: 230px;
    font-size: 0.64rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
