.properties-view {
  --property-green: #15735b;
  --property-green-soft: #e2f3ed;
}

/* Formulario y ficha simplificados para publicaciones de Marketplace */
.simplified-property-filters {
  grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(150px, 1fr)) minmax(190px, 1fr) auto;
  align-items: end;
}

.simplified-property-card {
  min-height: 0;
  border-top: 4px solid var(--property-green);
}

.simplified-property-card .property-card-body {
  display: grid;
  gap: 11px;
  padding: 22px;
}

.simplified-property-card h3 {
  margin: 0;
  color: #18201d;
  font-size: 1.15rem;
  line-height: 1.35;
}

.property-type-label {
  color: var(--property-green);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.simplified-property-card .property-location,
.simplified-property-card .property-price {
  margin: 0;
}

.simplified-property-card .property-status {
  width: max-content;
}

.property-status.Apartada {
  background: #fef3c7;
  color: #96630a;
}

.property-status.No-disponible {
  background: #eef0f3;
  color: #596270;
}

.property-form-section:first-child {
  border-top: 4px solid var(--property-green);
}

.property-form-section:nth-child(2) {
  border-top: 4px solid #b08d42;
  background: #fffcf4;
}

.property-form-section header h3 {
  letter-spacing: .025em;
}

.commission-estimate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #d9c78f;
  border-radius: 11px;
  background: #fff8e5;
}

.commission-estimate span {
  color: #756229;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.commission-estimate strong {
  color: #28200d;
  font-size: 1.15rem;
}

.simplified-property-hero {
  align-items: flex-start;
}

.simplified-property-hero .property-detail-actions {
  max-width: 570px;
}

.property-public-section,
.property-private-section {
  margin-top: 20px;
  padding: 22px;
  border: 1px solid #dfe7e3;
  border-radius: 16px;
  background: #fff;
}

.property-private-section {
  border-color: #ddce9d;
  background: #fffcf4;
}

.property-public-section > header,
.property-private-section > header {
  margin-bottom: 17px;
}

.property-public-section h3,
.property-private-section h3 {
  margin: 4px 0 0;
  color: #18201d;
  font-size: 1.18rem;
}

.property-public-section header span,
.property-private-section header span {
  color: #7b7468;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.property-related-tabs {
  margin-top: 24px;
}

.property-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  max-width: min(390px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: 11px;
  background: #15231e;
  color: #fff;
  font-size: .88rem;
  font-weight: 800;
  box-shadow: 0 14px 38px rgba(15, 30, 24, .24);
}

@media (max-width: 980px) {
  .simplified-property-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .simplified-property-filters .property-search-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .simplified-property-filters,
  .property-form-grid {
    grid-template-columns: 1fr;
  }

  .simplified-property-filters > *,
  .property-form-grid > * {
    grid-column: auto;
  }

  .property-public-section,
  .property-private-section {
    padding: 16px;
  }

  .commission-estimate {
    align-items: flex-start;
    flex-direction: column;
  }

  .property-toast {
    right: 16px;
    bottom: 16px;
  }
}

.property-module-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.property-module-head h2 {
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 26px;
}

.property-module-head p:last-child {
  margin: 0;
  color: var(--muted);
}

.property-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 13px;
  margin-bottom: 22px;
}

.property-summary-grid article {
  min-height: 110px;
  display: grid;
  align-content: space-between;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(16, 38, 64, .07);
}

.property-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.property-summary-grid strong {
  color: var(--ink);
  font-size: 31px;
}

.property-summary-grid article:nth-child(2) {
  border-bottom: 3px solid var(--property-green);
}

.property-summary-grid article:nth-child(3) {
  border-bottom: 3px solid var(--accent);
}

.property-summary-grid article:nth-child(4) {
  border-bottom: 3px solid #516175;
}

.property-filters.panel {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(135px, 1fr));
  gap: 13px;
  margin-bottom: 24px;
  padding: 20px;
}

.property-filters label,
.property-search-wide {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.property-filters input,
.property-filters select {
  width: 100%;
  min-height: 41px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font-weight: 400;
}

.property-search-wide {
  grid-column: span 2;
}

.clear-property-filters {
  align-self: end;
}

.property-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.property-results-head h3 {
  margin: 0;
}

.property-results-head span {
  color: var(--muted);
  font-size: 13px;
}

.property-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.property-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}

.property-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 40px rgba(16, 38, 64, .13);
}

.property-card-image {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: linear-gradient(145deg, #dce6ef, #eef3f8);
}

.property-card-image > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.property-image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(10, 35, 66, .34);
  background:
    linear-gradient(135deg, transparent 0 49%, rgba(255, 255, 255, .42) 50% 51%, transparent 52%),
    var(--accent-pale);
}

.property-image-placeholder svg {
  width: 72px;
  height: 72px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}

.property-status,
.featured-property {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
}

.property-card-image > .property-status {
  position: absolute;
  left: 13px;
  top: 13px;
}

.property-status.Disponible {
  color: #0b6a4c;
  background: #d9f7ea;
}

.property-status.En-negociacion {
  color: #8a5a05;
  background: #fff1c2;
}

.property-status.Reservada {
  color: #7047a5;
  background: #efe3ff;
}

.property-status.Vendida,
.property-status.Rentada {
  color: #fff;
  background: var(--nav);
}

.property-status.Retirada {
  color: #616b77;
  background: #e7ebef;
}

.featured-property {
  position: absolute;
  right: 13px;
  top: 13px;
  color: var(--nav);
  background: var(--accent);
}

.property-card-body {
  padding: 19px;
}

.property-card-title span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .09em;
}

.property-card-title h3 {
  min-height: 44px;
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.property-location {
  min-height: 34px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.property-card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.property-card-facts span {
  padding: 5px 7px;
  border-radius: 6px;
  color: #4d5b6c;
  background: #f0f4f7;
  font-size: 10px;
  font-weight: 700;
}

.property-price {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 23px;
}

.property-price small {
  color: var(--muted);
  font-size: 10px;
}

.property-card-counts {
  display: flex;
  gap: 13px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.property-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}

.property-card-actions .button,
.property-card-actions .small-action {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.danger-action {
  color: var(--danger);
}

.property-empty {
  grid-column: 1 / -1;
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #cad3dd;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, .58);
  text-align: center;
}

.property-empty strong {
  color: var(--ink);
  font-size: 21px;
}

.property-empty p {
  margin-bottom: 8px;
}

.property-modal {
  width: min(1080px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
}

.property-modal form {
  padding: 24px;
}

.property-form-content {
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding-right: 8px;
}

.property-form-section {
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fbfcfe;
}

.property-form-section > header {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.property-form-section > header > span {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  flex: 0 0 35px;
  border-radius: 50%;
  color: var(--nav);
  background: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.property-form-section h3 {
  margin: 0 0 3px;
  color: var(--ink);
  font-size: 17px;
}

.property-form-section header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.property-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.property-field {
  display: grid;
  gap: 6px;
}

.property-field.full,
.property-check-group,
.property-file-notice.full {
  grid-column: 1 / -1;
}

.property-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.property-field input,
.property-field select,
.property-field textarea {
  width: 100%;
  min-height: 41px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
}

.property-field textarea {
  min-height: 88px;
  resize: vertical;
}

.property-check-group {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.property-check-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.property-check-group > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.property-check-group label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #4f5d6d;
  font-size: 11px;
}

.property-file-notice {
  margin: 0;
  padding: 11px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: var(--accent-pale);
  font-size: 11px;
}

.property-detail-modal {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
}

.property-detail-shell {
  padding: 24px;
}

.property-detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--nav), #173e64);
}

.property-detail-hero p {
  margin: 9px 0 5px;
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
}

.property-detail-hero > div > strong {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 28px;
}

.property-detail-hero small {
  color: rgba(255, 255, 255, .72);
}

.property-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  justify-content: flex-end;
}

.property-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin-bottom: 18px;
  padding-bottom: 4px;
}

.property-tabs button {
  min-width: max-content;
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: #eef2f6;
  font-size: 11px;
  font-weight: 800;
}

.property-tabs button.active {
  color: var(--nav);
  background: var(--accent);
}

.property-tab-panel {
  display: none;
  max-height: calc(100vh - 315px);
  overflow: auto;
}

.property-tab-panel.active {
  display: block;
}

.property-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.property-detail-grid > div {
  min-height: 65px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}

.property-detail-grid span,
.property-detail-grid strong {
  display: block;
}

.property-detail-grid span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.property-detail-grid strong {
  white-space: pre-wrap;
  font-size: 12px;
  font-weight: 600;
}

.legal-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}

.legal-status-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  font-size: 10px;
}

.legal-ok {
  color: #075e42;
  background: #dff5ec;
}

.legal-review {
  color: #8a5b07;
  background: #fff1c8;
}

.related-panel-head,
.related-record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
}

.related-panel-head {
  margin-bottom: 12px;
}

.related-record {
  margin-bottom: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}

.related-record strong,
.related-record span,
.related-record small {
  display: block;
}

.related-record strong {
  margin-bottom: 4px;
  font-size: 12px;
}

.related-record span,
.related-record small {
  color: var(--muted);
  font-size: 10px;
}

.related-record > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.history-record {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.history-record > span {
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border: 3px solid var(--accent);
  border-radius: 50%;
}

.history-record strong,
.history-record small {
  display: block;
}

.history-record strong {
  font-size: 12px;
}

.history-record small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.property-sub-modal {
  width: min(850px, calc(100vw - 28px));
}

.property-sub-modal form {
  padding: 22px;
}

.property-sub-modal .form-grid {
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding-right: 5px;
}

.property-sub-modal .field select[multiple] {
  min-height: 105px;
}

.property-sub-modal .field small {
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1280px) {
  .property-summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .property-filters.panel {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  .property-module-head,
  .property-detail-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .property-summary-grid,
  .property-filters.panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .property-search-wide {
    grid-column: 1 / -1;
  }

  .property-card-grid {
    grid-template-columns: 1fr;
  }

  .property-form-grid,
  .property-detail-grid,
  .legal-status-grid {
    grid-template-columns: 1fr;
  }

  .property-check-group > div {
    grid-template-columns: repeat(2, 1fr);
  }

  .property-detail-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .property-summary-grid,
  .property-filters.panel {
    grid-template-columns: 1fr;
  }

  .property-check-group > div {
    grid-template-columns: 1fr;
  }

  .property-card-actions .button,
  .property-card-actions .small-action {
    flex: 1 1 calc(50% - 7px);
  }
}

/* Ajustes finales con prioridad sobre el diseño anterior del módulo. */
.property-filters.panel.simplified-property-filters {
  grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(150px, 1fr)) minmax(190px, 1fr) auto;
}

.property-card.simplified-property-card {
  display: block;
  min-height: 0;
  border-top: 4px solid var(--property-green);
}

@media (max-width: 980px) {
  .property-filters.panel.simplified-property-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .property-filters.panel.simplified-property-filters {
    grid-template-columns: 1fr;
  }
}
