.crmprop-scope {
  --crmprop-accent: #2563eb;
  --crmprop-radius: 12px;
}

.crm-properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.crmprop-scope .crm-property-card {
  position: relative;
}

.crm-property-card {
  border: 1px solid #e2e2e2;
  border-radius: var(--crmprop-radius);
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.crm-property-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #f6f6f6;
  line-height: 0;
}

.crm-property-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.crm-property-image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #777;
  background: #f6f6f6;
}

.crm-property-content {
  padding: 16px;
  background: #fff;
}

/* Defensive reset against theme CSS collisions on generic class names */
.crmprop-scope .crm-property-content {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  margin: 0 !important;
  z-index: auto !important;
  width: auto !important;
  max-width: none !important;
  background: #fff !important;
  color: inherit;
}

.crmprop-scope .crm-property-image + .crm-property-content {
  margin-top: 0 !important;
}

.crm-property-content h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.crm-property-location,
.crm-property-meta {
  margin: 4px 0;
  color: #666;
}

.crm-property-price {
  margin: 10px 0;
  font-weight: 600;
}

.crm-property-button {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--crmprop-accent);
  color: #fff;
  text-decoration: none;
}

/* New detail layout */
.crmprop-detail {
  max-width: 1200px;
  margin: 0 auto;
  color: #111827;
}

.crmprop-hero {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.crmprop-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--crmprop-accent);
  text-decoration: none;
  margin-bottom: 12px;
}

.crmprop-back:hover {
  text-decoration: underline;
}

.crmprop-kicker {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #6b7280;
}

.crmprop-title {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.2;
  margin: 0;
}

.crmprop-location {
  color: #4b5563;
  font-size: 16px;
}

.crmprop-price {
  font-size: 22px;
  font-weight: 600;
  color: var(--crmprop-accent);
}

.crmprop-status {
  margin-top: 8px;
}

.crmprop-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--crmprop-radius);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #86efac;
}

.crmprop-marketing {
  font-size: 14px;
  color: #6b7280;
}

.crmprop-gallery {
  margin-bottom: 24px;
  display: grid;
  gap: 12px;
}

.crmprop-gallery-main {
  position: relative;
  border-radius: var(--crmprop-radius);
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.crmprop-gallery-main img {
  width: 100%;
  height: clamp(220px, 50vw, 520px);
  display: block;
  object-fit: cover;
}

.crmprop-gallery-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.crmprop-thumb {
  border: 2px solid transparent;
  border-radius: var(--crmprop-radius);
  padding: 0;
  background: #ffffff;
  cursor: pointer;
  min-width: 84px;
  height: 72px;
  flex: 0 0 auto;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.crmprop-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.crmprop-thumb.is-active {
  border-color: var(--crmprop-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.crmprop-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.crmprop-gallery-prev {
  left: 12px;
}

.crmprop-gallery-next {
  right: 12px;
}

.crmprop-gallery-empty {
  border: 1px dashed #d1d5db;
  padding: 40px;
  text-align: center;
  border-radius: var(--crmprop-radius);
  color: #6b7280;
}

@media (max-width: 960px) {
  .crmprop-gallery-main img {
    height: clamp(200px, 60vw, 420px);
  }
  .crmprop-gallery-thumbs {
    display: none;
  }
}

.crmprop-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.crmprop-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.crmprop-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.crmprop-fact {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: var(--crmprop-radius);
  padding: 12px;
}

.crmprop-fact-empty {
  background: #fefce8;
  border-color: #fde68a;
}

.crmprop-fact-label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.crmprop-fact-value {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.crmprop-description {
  line-height: 1.7;
  font-size: 16px;
  color: #374151;
}

.crmprop-facts-blocks {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.crmprop-facts-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px;
}

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

.crmprop-facts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--crmprop-radius);
  background: #f7f8fa;
  border: 1px solid #eef0f3;
}

.crmprop-facts-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
}

.crmprop-facts-value {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-align: right;
}

.crmprop-description summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}

.crmprop-request {
  border: 1px solid #e5e7eb;
  border-radius: var(--crmprop-radius);
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.crmprop-debug {
  margin-top: 20px;
  border: 1px dashed #d1d5db;
  background: #f9fafb;
  padding: 12px;
  border-radius: var(--crmprop-radius);
  font-size: 12px;
  color: #374151;
}

.crmprop-debug-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.crmprop-debug-table th,
.crmprop-debug-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.crmprop-debug-warning {
  margin-top: 8px;
  font-weight: 600;
  color: #92400e;
}

.crmprop-debug-pre {
  margin-top: 6px;
  padding: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--crmprop-radius);
  white-space: pre-wrap;
}

@media (min-width: 960px) {
  .crmprop-sticky {
    position: sticky;
    top: 24px;
    align-self: start;
  }
}

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

.crmprop-field label {
  display: block;
  font-size: 14px;
  color: #374151;
  margin-bottom: 6px;
}

.crmprop-field input,
.crmprop-field textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: var(--crmprop-radius);
  padding: 10px 12px;
  font-size: 14px;
}

.crmprop-field-error {
  color: #b91c1c;
  font-size: 12px;
  margin-top: 4px;
}

.crmprop-consent {
  font-size: 13px;
}

.crmprop-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.crmprop-button {
  background: var(--crmprop-accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.crmprop-success {
  background: #ecfdf3;
  border: 1px solid #86efac;
  color: #166534;
  padding: 10px 12px;
  border-radius: var(--crmprop-radius);
  margin-bottom: 12px;
}

.crmprop-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: var(--crmprop-radius);
  margin-bottom: 12px;
}

.crmprop-stale-notice {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  padding: 10px 12px;
  border-radius: var(--crmprop-radius);
  margin-bottom: 14px;
  font-size: 14px;
}

@media (max-width: 900px) {
  .crmprop-grid {
    grid-template-columns: 1fr;
  }
  .crmprop-facts-rows {
    grid-template-columns: 1fr;
  }
}
